Hi Harry,
data in the app.config isn't readonly at all! It can be accessed through the
configurationmanager-class (but not by my.settings, that's right). Below you
find code I use to set the connection-string at runtime. Be aware of the
fact, that you can use more than one connectionstring in your config, hence
the SectName.
Public Shared Sub SetConnectString(ByVal SectName As String, ByVal
ConnectString As String, ByVal encrypt As Boolean)
Dim settings As New ConnectionStringSettings
settings.Name = SectName
settings.ConnectionString = ConnectString
Dim config As Configuration
config =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None)
config.ConnectionStrings.ConnectionStrings.Remove( SectName)
config.ConnectionStrings.ConnectionStrings.Add(set tings)
If encrypt Then
config.ConnectionStrings.SectionInformation.Protec tSection(Nothing)
End If
config.Save()
End Sub
HTH
Volker
"harry" wrote:
I've set my database connection as an Application.Setting using the
designer.
Since Application.Settings are read only, how do I change the connection
properties when deploying to another machine ?
Thanks
Harry