Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the connection string for an SQL Express database listed in LINQPad?

Is there an easy way to get the connection string of a database listed in the connection window of LINQPad (other than using the object explorer of Visual Studio)?

like image 294
tuncalik Avatar asked Aug 18 '14 10:08

tuncalik


2 Answers

Making sgmoore's comment into an answer:

try this.Connection.ConnectionString.Dump();

like image 170
2 revs Avatar answered Sep 25 '22 09:09

2 revs


In LinqPad 5 if your Language dropdown is set to C# Program and you have a database selected in the Connection dropdown, then you can get your string using

string c = LINQPad.Util.CurrentDataContext.Connection.ConnectionString;
like image 38
Mike Brady Avatar answered Sep 25 '22 09:09

Mike Brady