How to find the connection string of your LocalDB database in Visual Studio

Today while I was developing a .NET Core example for testing Dapper against my LocalDB tables, I had to define the connection string so that I can run queries in my code against the database. If I was to use Entity Framework, then the connection string would be scaffolded for me, but now I have to find it on my own.

After some searching in the properties of the SQL Server Object Explorer tab, I finally found the string I was looking for.

Just right click on the database you want to use in your project:

Find the connection string of a localDB database

and then you can copy the connection string from the Properties tab:

Find the connection string of a localDB database

I hope this little tip will help some of you in the future.

comments powered by Disqus