Opening existing project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BD5
    New Member
    • Sep 2007
    • 12

    Opening existing project

    HEllo all,

    I got a project sent to me, and I want to open it, it is delivered with a .mdf file. I downloaded VS 2008 and SQL server 2005, and i opened the project with VS2008.
    But when i want to open a page that required data the page says:

    An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


    Now I really don't know what to do to make sure the .mdf info will work, how should I do this? I open Microsoft SQL 2005 server, but what should I do then??
    (Sometimes people talk about 'attaching', but I don't have a clue what that means, or how to do it..)

    Cheers and thanks
  • Purple
    Recognized Expert Contributor
    • May 2007
    • 404

    #2
    Hi BD5 and welcome to TSDN

    did you get a database_name.l df file too ?

    copy both the .mdf and .ldf files into the data directory of

    program files / microsoft sql server / mssql / data

    the path should look something like above, you will see other .mdf and .ldf files in there.

    then use microsoft sql server management studio to connect to your sql server. Right click on the database folder and select attach, follow the wizard..

    hope that helps

    Regards Purple

    Comment

    • BD5
      New Member
      • Sep 2007
      • 12

      #3
      Originally posted by Purple
      did you get a database_name.l df file too ?



      Regards Purple
      Thanks for the help!

      I did not get a .ldf file with it... is it necessary?? By the way, that manager program you are talking about.. is it this program:



      Because I right clicked those items, but I can't find attach..

      Comment

      • BD5
        New Member
        • Sep 2007
        • 12

        #4
        Can anyone help me please? :) I am really stucking here..

        Comment

        • Shashi Sadasivan
          Recognized Expert Top Contributor
          • Aug 2007
          • 1435

          #5
          Originally posted by BD5
          Can anyone help me please? :) I am really stucking here..
          Hi BD5,
          open SQL Sever, and connect to the sever...(it should connect on startup)
          wight click on databases -> Attach

          click add and choose the .mdf file u got.

          Now on the window just below that, select the .ldf file, and remove it.

          And then click OK.

          Cheers

          Comment

          • BD5
            New Member
            • Sep 2007
            • 12

            #6
            Thank you!

            I could attach it!

            But when I want to open a page, I still get this error:


            Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

            Exception Details: System.Data.Sql Client.SqlExcep tion: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

            Source Error:


            Line 97: private void LoadAndBindQuer y(Query query)
            Line 98: {
            Line 99: EventsRepeater. DataSource = query.ExecuteRe ader();
            Line 100: EventsRepeater. DataBind();
            Line 101: }


            How can I fix this?Thank you guys!

            Comment

            • ck9663
              Recognized Expert Specialist
              • Jun 2007
              • 2878

              #7
              Originally posted by BD5
              Thank you!

              I could attach it!

              But when I want to open a page, I still get this error:


              Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

              Exception Details: System.Data.Sql Client.SqlExcep tion: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

              Source Error:


              Line 97: private void LoadAndBindQuer y(Query query)
              Line 98: {
              Line 99: EventsRepeater. DataSource = query.ExecuteRe ader();
              Line 100: EventsRepeater. DataBind();
              Line 101: }


              How can I fix this?Thank you guys!

              check the way your program/application is connecting to your db. there are tons of ways you can connect into db so depending on the way your application connects, you can start from there.

              Comment

              • BD5
                New Member
                • Sep 2007
                • 12

                #8
                I currently use this connectionstrin g:
                The database file was Project.mdf

                <connectionStri ngs>
                <add name="ProjectCo nnectionString" connectionStrin g="Data Source=.;Initia l Catalog=Project ;Integrated Security=True;"/>
                </connectionStrin gs>

                <SubSonicServic e defaultProvider ="SqlDataProvid er" fixPluralClassN ames="true">
                <providers>
                <add name="SqlDataPr ovider" type="SubSonic. SqlDataProvider , SubSonic" connectionStrin gName="ProjectC onnectionString "/>
                </providers>
                </SubSonicService >



                Is this wrong?

                Comment

                • ck9663
                  Recognized Expert Specialist
                  • Jun 2007
                  • 2878

                  #9
                  Originally posted by BD5
                  I currently use this connectionstrin g:
                  The database file was Project.mdf

                  <connectionStri ngs>
                  <add name="ProjectCo nnectionString" connectionStrin g="Data Source=.;Initia l Catalog=Project ;Integrated Security=True;"/>
                  </connectionStrin gs>

                  <SubSonicServic e defaultProvider ="SqlDataProvid er" fixPluralClassN ames="true">
                  <providers>
                  <add name="SqlDataPr ovider" type="SubSonic. SqlDataProvider , SubSonic" connectionStrin gName="ProjectC onnectionString "/>
                  </providers>
                  </SubSonicService >



                  Is this wrong?

                  http://www.connections trings.com/

                  Comment

                  Working...