Reputation: 130
I have created a SQL Server database in Visual Studio 2017 Community edition. I can see it in "Data Connections", and it works fine. I can view and edit tables in Visual Studio without any problem.
I can also see the physical file in Windows file explorer. However, when I try and look at it in SQL Server Management Studio (or Power BI), the applications can't seem to find it. The Management Studio seems to think I have multiple instances of SQL Server Express available, but none of them list my application database as being present.
For example
Can anyone put me on the right track as to how to connect this database to SQL Server Management Studio.
Sorry if it's obvious, but I've spent a couple of days on this, and I'm ready to beat my head against a wall.
Any help gratefully received.
Upvotes: 0
Views: 1047
Reputation: 1297
Check the properties of data connection to identity into which SQL Instance the database being saved/deployed from VS.
The management studio seems to think I have multiple instances of SQL Express available, but none of them list my application database as being present
The tool cannot think/recognize of something not installed, either you might have connected the listed SQL Instances earlier or they installed locally. you can identity all installed SQL Instances via SQL Server configuration manager.
Deepening on version you can open SSCM via run
command (following) from windows:
run
--> SQLServerManager14.msc
run
--> SQLServerManager13.msc
run
--> SQLServerManager12.msc
Seems your database saving at SQLLocalDB
instance which is light version of SQL Engine, doesn't required any service installation. The regular method of connecting database server would not work in Local DB case, you must follow these steps, and these steps for details
In case if the development has been done, and you want work with same database on SQL Express instance, you can use attach method to bring database into one of SQL Instance, following steps would help to do that:
Investments 4 copy.mdf
.MDF
into desired location where you want the data storage to beCREATE DATABASE YourDBName
ON (FILENAME = 'D:\CopiedLocation\CopiedFile.mdf')
FOR ATTACH_REBUILD_LOG ;
GO
Upvotes: 1