Reputation:
I have a simple problem but have searched all across google and SO to no avail.
I have a .mdf
file that has 3 tables, I am working with this file in ASP.NET WebForms e.g updating, adding data etc... I want to be able to view the contents of the .mdf
file in Visual Studio to make sure that the queries (written in C#) are working correctly.
At the moment I am doing this by opening the file in SQL Server 2014 but that way I have to close visual studio as the file can only be used on instance.
I know this can be achieved by connecting to a server but this is and .mdf
file.
Any suggestions?
Upvotes: 3
Views: 14709
Reputation: 19
Create an empty solution with empty project in visual studio.
Add a mdf file to project(Right click on project--> Add Existing Items)
Now double click on mdf file which will open server explorer/database explorer.
Then expand db to see table, views .. etc...
Upvotes: 1
Reputation: 7301
Go to View > SQL Server Object Explorer right click the SQL Server node
and select Add SQL server
.
But be aware. If you are developing a program that uses this connection to, then the application might throw an exception saying that you can connect to the database only once.
Upvotes: 4