简体   繁体   English

无法将sql数据库添加到我的项目

[英]can't add a sql database to my project

I have VS 2013 ultimate. 我有VS 2013 Ultimate。 I'm trying to add a sql database file to my project App_Data. 我正在尝试将sql数据库文件添加到我的项目App_Data中。 What I did was I right-clicked App_Data, added new item, named my file database1.mdf, and then tried to add the file, but when i do it gives me this error 我所做的是右键单击App_Data,添加了新项,名为我的文件database1.mdf,然后尝试添加该文件,但是当我这样做时,出现此错误

A network-related or instance-specific error occurred while establishing a connection to sql server. 建立与sql服务器的连接时发生与网络相关或特定于实例的错误。 The server was not found or was not accessible. 服务器未找到或无法访问。 Verify that the instance name is correct and that SQL server is configured to allow remote connections. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network interfaces, error: 50 - local Database runtime error occurred: Cannot create an automatic instance. See the windows application event log). (提供者:SQL网络接口,错误:50-发生本地数据库运行时错误:无法创建自动实例。请参见Windows应用程序事件日志)。

Now the werid part is. 现在最疲软的部分是。 This USE to work. 这种使用工作。 Til last night when I deleted something something or messed with something, I really can't remember what. 直到昨晚我删除某些内容或弄乱了某些内容时,我真的不记得发生了什么。 I also noticed my master.mdf file is gone. 我还注意到我的master.mdf文件不见了。 I went into control panel and services to see if an instance of sql server is running. 我进入控制面板和服务,以查看sql server实例是否正在运行。 It is not, but it is set to automatic. 它不是,但是设置为自动。 I tried to run it through services, and got this error. 我尝试通过服务运行它,并收到此错误。

"Windows could not start the SQL server (SQLEXPRESS) on local computer. For more information, review the system event log. If this is a non-microsoft service, contact the service vendor, and refer to service-specific error code 17113" “ Windows无法在本地计算机上启动SQL Server(SQLEXPRESS)。有关更多信息,请查看系统事件日志。如果这是非Microsoft服务,请与服务供应商联系,并参考特定于服务的错误代码17113”

This is driving me crazy, I'm about to format my windows, and reinstall everything. 这让我发疯,我要格式化我的窗口,然后重新安装所有内容。 I spent a day trying to figure out what i might have messed with or deleted that screwed this up, because it was working correctly the other day. 我花了一天的时间来弄清楚我可能搞砸了什么或删除了哪些内容,这使它搞砸了,因为前一天它可以正常工作。 Please help. 请帮忙。

Open up the Command window(run->cmd or "Win"+"R") and type: 打开命令窗口(运行-> cmd或“ Win” +“ R”),然后键入:

C:\\Users\\xxx\\sqllocaldb delete "v11.0" C:\\ Users \\ xxx \\ sqllocaldb删除“ v11.0”

The following row should be shown: LocalDB instance "v11.0" deleted 应该显示以下行:LocalDB实例“ v11.0”已删除

Then type the following row: 然后键入以下行:

C:\\Users\\xxx\\sqllocaldb create "v11.0" C:\\ Users \\ xxx \\ sqllocaldb创建“ v11.0”

The following row should be shown: LocalDB instance "v11.0" created with version 11.0 应该显示以下行:用版本11.0创建的LocalDB实例“ v11.0”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM