Migrating my files with mdf databases

Discussion in 'C#' started by ds2r, Aug 30, 2010.

  1. ds2r

    ds2r New Member

    Joined:
    Aug 30, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Good day everyone!
    I'm still a noob with C#.NET so patience pls! :)

    I'm making a Windows Forms Application with a database from MS SQL 2005 Express.
    I want to transfer this projects with the database to another pc.
    What should I do? Should I transfer the database (.mdf and the log) from the MS SQL folder along with the project?

    I have this connection string inside the application

    @"Data Source="+Environment.MachineName+"\\SQLEXPRESS;Initial Catalog=BFootwear;Integrated Security=True;";
    I made the Environment.MachineName to get the datasource automatically. This was also automatically generated and I copy pasted it from the properties of the database in the server explorer.

    I also have a dataset in my application. Will it be affected?

    I tried it but I had i-cant-understand-why results. The connection string from the properties in the server explorer changed to
    Data Source=.\SQLEXPRESS;AttachDbFilename="xxx";Integrated Security=True;Connect Timeout=30;User Instance=Truewhere the xxx is the directory of the database.

    Then when i compiled it, it doesn't connect anymore.

    Any help would be appreciated.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice