Reputation: 2532
I'm using LINQ in visual studio using the DataClasses Where can I change the connection string from the code?
Upvotes: 1
Views: 269
Reputation: 1097
You should be able to add a connection string to your project's App.config or Web.config, then when you instantiate your data context, you should be able to supply the name of the connection string to use. e.g.:
<connectionStrings>
<add name="connectionName" value="..." />
</connectionStrings>
var context = new DataContext( "connectionName" );
Upvotes: 4