0

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 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.