我的程序在哪里创建数据库? [英] Where is the database my program created?
问题描述
我有一个ASP .NET MVC应用程序. "MovieDBContext"是一种控制器的方法,该方法返回有关视图中电影列表的一些基本信息.我知道数据库正在运行,因为我可以使用Code First和Entity Framework输入新电影并删除它们等.
这是web.config文件的连接设置.
I have an ASP .NET MVC application. "MovieDBContext" is a method of a controller that returns some basic information about a list of movies in a view. I know the database is working as I can enter new movies and delete them etc. using Code First and Entity Framework.
This is the web.config file connection settings.
<configuration>
<connectionStrings>
<add name="MovieDBContext"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;database=MvcMovie;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
我在SQL Server Management Studio中查看了数据库列表,但它不存在.我已经在Visual Studio 2010中单击了App_Data文件,但是没有打开任何数据库.除了通过程序本身(最好是管理工作室)之外,我还希望有一种查看数据库中数据的方法.有任何想法吗? :)
I''ve looked in my list of databases in SQL Server Management Studio but it''s not there. I''ve clicked on the App_Data file in the Visual Studio 2010 but that doesn''t open up any databases. I''ve wanted a way to look at the data in the database other than through the program itself, preferably the management studio. Any ideas? :)
推荐答案
将其用作查询字符串(将创建一个在Management Studio中查看的新数据库):
Use this instead for the query string (will create a new database viewed in the management studio):
<add name="MovieDBContext">
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;database=MvcMovie;
providerName="System.Data.SqlClient" /></add>
或在解决方案资源管理器"中双击App_Data之前按显示所有文件"选项.
Or press "Show all files" option before double clicking the App_Data in the Solution Explorer.
这篇关于我的程序在哪里创建数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!