Connecting to a LocalDb instance from Visual Studio

2015-05-01

Visual Studio allows you to connect to a database server through the "Server Explorer" tab. However, I always forget how to connect to the LocalDb instance when I'm just prototyping in ASP.NET MVC. Here's a small reminder.

Open the Server Explorer Tab

From within Visual Studio, click View -> Server Explorer or just Ctrl-Alt-s

Pull up the add new connection modal

Click the little plug with a plus next to it to bring up the Add Connection modal

Connect

The server name drop down doesn't usually display your local db instance, so typing is your best option. Put the following into your Server name text box:

(LocalDb)\V11.0

Then choose your database and click Ok.

An elephant never forgets

This is annoying to remember, so take a quick glance at your web.config file and simply copy the (LocalDb)\V11.0 from your connectionString.