locked
Changing LocalDb to .\SQLEXPRESS RRS feed

  • Question

  • User1953081067 posted

    Hi

    I have an older web application running locally that uses LocalDb to connect:

    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-mydb.mdf;Initial Catalog=aspnet-mydb;Integrated Security=True" providerName="System.Data.SqlClient" />

    I've recently installed SQL Express 2014 and I'd like to change the above to now use .\SQLEXPRESS.

    Can someone please show me how to update the above so that it works?

    Thanks as always

    Sunday, May 15, 2016 1:13 AM

Answers

  • User-821857111 posted
    <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-mydb.mdf;Initial Catalog=aspnet-mydb;Integrated Security=True" providerName="System.Data.SqlClient" />
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 16, 2016 6:41 AM
  • User-166373564 posted

    Hi,

    The following code snippet is for a SQL Server Express database that is defined in the local SQL Server Express instance.

    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"/>
    
    

    Further information: SQL Server Connection Strings for ASP.NET Web Applications

    have a good day.

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 16, 2016 7:18 AM

All replies

  • User-821857111 posted
    <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-mydb.mdf;Initial Catalog=aspnet-mydb;Integrated Security=True" providerName="System.Data.SqlClient" />
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 16, 2016 6:41 AM
  • User-166373564 posted

    Hi,

    The following code snippet is for a SQL Server Express database that is defined in the local SQL Server Express instance.

    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"/>
    
    

    Further information: SQL Server Connection Strings for ASP.NET Web Applications

    have a good day.

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 16, 2016 7:18 AM