'Linqpad DB connections - get it to NOT connect when I open a file?

I have many LinqPad scripts I use to query databases. These files are all in dropbox so I have all my queries available across computers. Very handy.

However each script is tied to a database connection, and that connection is not valid across computers. I'm guessing it has to do with how the passwords are stored. And that's OK.

But what is annoying is when I open a script, LinqPad attempts to connect to the invalid database. It is frozen while this happens. Once it is done, all I have to do is change it to the new db and it's fine. But this freeze interrupts my flow.

Is there a way to tell Linqpad to NOT try to connect when I open a file?



Solution 1:[1]

you can use a connection by connection string so you can add some read key or any machanics to execute connection

using(TypedDataContext context = new TypedDataContext(Connection.ConnectionString)){
        
        context.table.Where(w=>w.ID == 123);
        
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Power Mouse