Cannot find database for SQL Server Express 2014

Two questions

  • How to connect to SQL Server Express database from SQL Management Studio?
  • How do I get an MVC Entity Framework application to connect to my original SQL Server Express LocalDB database .

My script

I have an MVC application installed to use IIS, and when I first started the application, he asked me to switch from SQL Server Express LocalDb to SQL Server Express.

SQL Server Express LocalDb to SQL Server Express

As a result, I no longer have data in the database, as I am now connecting to the new database server.

Before / after

Question 1: How to connect to SQL Server Express database from SQL Management Studio?

How to Connect to SQL Server Express?

2: MVC Entity Framework SQL Server Express LocalDB?

SQL Server Express LocalDB unit test, MVC, "SQL Server Express"

UnitTest

Unit Test LocalDB

<connectionStrings>
    <add name="RqDbContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=Rq;Integrated Security=True;Pooling=false" providerName="System.Data.SqlClient" />
</connectionStrings>

Web.config

- ,

<connectionStrings>
    <add name="RqDbContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=Rq;Integrated Security=True;" providerName="System.Data.SqlClient" />
</connectionStrings>

, Unit Test LocalDB, -, , .

.

, , , .

,

Website vs Nuit

+4
1

, :

1) , SQL Server Express . :

  • "", services.msc
  • SQL Server (....) " . - , , SQL Server.

2) Management Studio:

  • Management Studio.
  • : .\(instancename)
  • - , 1.

3) LocalDb Sql:

  • LocalDb. LocalDb "C:\Users ( )".
  • MDF LDF , .
  • . MDF SQL Server.

4) SQL Server :

  • , SQL Server LocalDb.
  • :

     <add name="RqDbContext" connectionString="Data Source=.\sqlexpress;Initial Catalog=Rq;Integrated Security=True;" providerName="System.Data.SqlClient" />
Hide result

, . !!

+1

All Articles