I can't believe I couldn't find a working solution to this after an hour of searching. I'm following this article on Entity Framework 6.0 which gives a simple walk-through on Code First. I created the project and installed the latest EF Nuget package for the project to compile. I also verified that I have Microsoft SQL Server 2012 Express LocalDB installed which came with Visual Studio 2013. I don't have any other instances of SQL installed on my local computer. The program runs and entries are added to the database and outputted in the console. But when the article says "check your localdb" it doesn't say how! I don't see any '.mdf' or '.ldf' files created under the project folder. I tried every way to connect Visual Studio's Server Explorer to LocalDB. The wizard cannot locate (localdb)
or cannot find any provider in Server Explorer to accept connection string like (localdb)\v11.0;Integrated Security=true;
I've seen this asked several places in StackOverflow but no answer works or marked as answer. Please help, this doesn't have to be this frustrating!
What are the steps to connect Visual Studio Server Explorer to LocalDB?
Fix doesn't work.
Exactly as in the example illustration, all these steps only provide access to "system" databases, and no option to select existing user databases that you want to access.
The solution to access a local (not Express Edition) Microsoft SQL server instance resides on the SQL Server side:
Done! Now you can select your local SQL Server from the Server Name list in Connection Properties.
It worked for me.
Visual Studio 2015 RC, has LocalDb 12 installed, similar instructions to before but still shouldn't be required to know 'magic', before hand to use this, the default instance should have been turned on ... Rant complete, no for solution:
Which will display
Your instance name might differ. Either way pop over to VS and open Server Explorer, right click Data Connections, choose Add, choose SQL Server, in the server name type:
Without entering in a DB name, click 'Test Connection'.
I followed the steps above, but I forgot to install the SQL Server 2014 LocalDB before the Visual Studio 2015 configuration.
My steps are as follow:
Hope this help anybody.
In Visual Studio 2012 all I had to do was enter:
Visual Studio 2015 and Visual Studio 2017 changed to:
as the server name when adding a
Microsoft SQL Server Data
source in:and then the database names were populated. I didn't need to do all the other steps in the accepted answer, although it would be nice if the server name was available automatically in the server name combo box.
You can also browse the LocalDB database names available on your machine using:
The fastest way in Visual Studio 2017 is to go to Tools -> SQL Server -> New query.. Choose from Local databases and choose the desired Database name at the bottom.
Alternative way
Visual Studio 2017 Server name is:
Add the new connection using menu Tools -> Connect to Database...