views:

173

answers:

2

I have two seperate databases, one is production the other is test. Before LINQ, I could simply change the connection string to swtich db's. However, the string is read only, and I have no way to change the string.

How can I change the Connection String programmatically?

Edited for Clarity

Im using my.settings to store all of this inforomation

+2  A: 

The DataContext object should have a constructor that takes a Connection String as a parameter. Alternatively, the default behavior is to pull it from the config file, so you can change it in the app.config/web.config file.

Chris Shaffer
A: 

I found a simple solution to the problem. Change the type from connection string to string, and set the Scope back to user.

Works just like it did before.

This does cause a different problem through. any time the dmbl file is updated, it causes an issue with the underlying vb file. the workaround I am using is to create a new contructor and make sure that the connection string is being pointed to properly

Aaron M