简体   繁体   中英

can't add a sql database to my project

I have VS 2013 ultimate. I'm trying to add a sql database file to my project 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

A network-related or instance-specific error occurred while establishing a connection to sql server. 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. (provider: SQL Network interfaces, error: 50 - local Database runtime error occurred: Cannot create an automatic instance. See the windows application event log).

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. I went into control panel and services to see if an instance of sql server is running. 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"

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:

C:\\Users\\xxx\\sqllocaldb delete "v11.0"

The following row should be shown: LocalDB instance "v11.0" deleted

Then type the following row:

C:\\Users\\xxx\\sqllocaldb create "v11.0"

The following row should be shown: LocalDB instance "v11.0" created with version 11.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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