Bgl*_*l86 4 c# sql-server asp.net-mvc entity-framework
我正在做Microsoft的MVC入门教程:
这包括创建代码优先数据库.
一切正常,但我无法找到我的数据库.
这是我的ConnectionString:
<add name="MovieDBContext" connectionString="Data Source=.\SQLEXPRESS; Integrated Security=True" providerName="System.Data.SqlClient"/>
Run Code Online (Sandbox Code Playgroud)
如果我调试我的索引方法连接如下:
Data Source=.\SQLEXPRESS; Integrated Security=True
Run Code Online (Sandbox Code Playgroud)
但是我的SQLEXPRESS实例中没有数据库,我已经使用SQL Server Management Studio进行了检查.
如果我搜索我的文件系统,我也找不到任何东西*.mdf.
App_Data 在我的项目是空的...
但是所有的CRUD操作都运行良好,必须有一些东西.
我能看到该表的唯一方法是.\SQLEXPRESS通过Visual Studio Server Explorer连接.但这个位置在哪里?如果我.\SQLEXPRESS通过SQL Server Management Studio 连接,为什么我看不到该表?
任何的想法?
Sal*_*ari 12
您没有Initial Catalog在连接字符串中指定,因此您可能正在使用Master数据库.
你需要指定Initial catalog如下:
<add name="MovieDBContext"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=yourDBName;Integrated Security=True"
providerName="System.Data.SqlClient"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1848 次 |
| 最近记录: |