locked
connection string RRS feed

  • Question

  • What connection string should I use in order to connect local database (added in project tree))
    Monday, September 12, 2011 3:12 PM

Answers

  • Hi Haris,

    <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
      </connectionStrings>

     

    Just provide the database name as master or create a test database

    Regards,

    Charan S

    • Proposed as answer by chaaraan Thursday, September 15, 2011 5:39 AM
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Monday, September 12, 2011 3:17 PM
  • Hi Haris,

    Check the following link for more information on ConnectionString

    http://www.connectionstrings.com/sql-server-2008


    PS.Shakeer Hussain
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Monday, September 12, 2011 3:52 PM
  • Data Source=MyData.sdf;Persist Security Info=False;

     

     

     

     


     

     

     

     


    Noam B.
    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...

     

     


    • Edited by Noam B Monday, September 12, 2011 3:57 PM
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Monday, September 12, 2011 3:57 PM
  • Hi Haris,

    You can use VS Server Explorer --->Add a connection, the Wizard will give your connection String.

    Or you can refer this link: http://www.connectionstrings.com/

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Devillish Sunday, September 18, 2011 6:59 PM
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Sunday, September 18, 2011 9:48 AM

All replies

  • Hi Haris,

    <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
      </connectionStrings>

     

    Just provide the database name as master or create a test database

    Regards,

    Charan S

    • Proposed as answer by chaaraan Thursday, September 15, 2011 5:39 AM
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Monday, September 12, 2011 3:17 PM
  • Hi Haris,

    Check the following link for more information on ConnectionString

    http://www.connectionstrings.com/sql-server-2008


    PS.Shakeer Hussain
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Monday, September 12, 2011 3:52 PM
  • Data Source=MyData.sdf;Persist Security Info=False;

     

     

     

     


     

     

     

     


    Noam B.
    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...

     

     


    • Edited by Noam B Monday, September 12, 2011 3:57 PM
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Monday, September 12, 2011 3:57 PM
  • Hi Haris,

    You can use VS Server Explorer --->Add a connection, the Wizard will give your connection String.

    Or you can refer this link: http://www.connectionstrings.com/

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Devillish Sunday, September 18, 2011 6:59 PM
    • Marked as answer by Alan_chen Tuesday, September 27, 2011 6:56 AM
    Sunday, September 18, 2011 9:48 AM