简体   繁体   中英

Why is no database shown in Visual Studio?

My SQL Server Object Explorer is not showing any databases:

SQL Server对象资源管理器 在此处输入图片说明

I also get an error A network-related or instance-specific error occurred while establishing a connection to SQL Server. ... A network-related or instance-specific error occurred while establishing a connection to SQL Server. ... . When I run the website, the error being shown is The system cannot find the file specified . Furthermore, SQL Server is missing from Services :

在此处输入图片说明

(It was installed together with Visual Studio and was never used separately)

Yesterday, everything worked like charm; I had multiple databases with tables and was able to access the data. Today, the same project can't even start, no db's either. What's wrong with Visual Studio here? Thanks

I've had the same problem before. Took me a while to figure it out. What you need to do is go here: https://www.microsoft.com/en-us/download/details.aspx?id=42299

In my case, i'm using SQL Server 2014 Management Studio. You must find the one that suits the version of SQL studio that you're using (2008, 2012, 2014).

Click the big download button and now, it is very important that you choose the proper version. Check:

  • Express 32BIT\\SQLEXPR_x86_ENU.exe if you're running on a 32-bit PC, or
  • Express 64BIT\\SQLEXPR_x64_ENU.exe if you're running on a 64-bit PC

It is very important that you install Express version.

Next, once you install that, you should be able to see the SQL Server (MSSQLSERVER) in your services.msc , along with few other SQL services installed.

Open Visual Studio 2015 and in SQL Server Object Explorer window right click on SQL Server and choose Add SQL Server... option. It should prompt you to connet to the server from SQL Server Management Studio.

If you kept everything by default during the installation, just type . (dot) for the Server name and click connect . Now it should load the database.

It turns out that Visual Studio does not come with MS SQL Server in the default installation. It is necessary to install SQL Server Data Tools from the MS website manually. VS custom installation also allows to do that, but you will need an installer. Just make sure to select SSDT in the custom installation components menu. Additionally, I also ran an update from VS itself that allowed me to install SQL Server 2008, 14, and 16. I am finally able to access DB in VS!

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