You can change the connection string at runtime like this. You set the connection string setting for the record as a separate property inside the MySettings class:
Partial Friend NotInheritable Class MySettings
Public WriteOnly Property RunTimeConnectionString()
Set(ByVal value)
My.Settings("MyConnectionString") = value
End Set
End Property
End Class
Then, in some place, when the application is initialized (before using any table adapters of typed datasets), write something like:
My.Settings.RunTimeConnectionString = My.Settings.ProductionConnectionString
Where ProductionConnectionString is a simple String parameter. This is a User Scope parameter, so each user can change it (assigning it a value similar to the code above) and save it by calling My.Settings.Save ()
This code works well for connection strings that were originally created in the main project and stored in it (app.config file).
app.config : MyApp.MySettings.MyConnectionString.
, app.config , , app.config - , .
, , , - . app.config. , : MyClassLibrary.My.MySettings.MyConnectionString.
, , - ?