Hi Harry,
data in the app.config isn't readonly at all! It can be accessed through the
configurationma nager-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 connectionstrin g in your config, hence
the SectName.
Public Shared Sub SetConnectStrin g(ByVal SectName As String, ByVal
ConnectString As String, ByVal encrypt As Boolean)
Dim settings As New ConnectionStrin gSettings
settings.Name = SectName
settings.Connec tionString = ConnectString
Dim config As Configuration
config =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None)
config.Connecti onStrings.Conne ctionStrings.Re move(SectName)
config.Connecti onStrings.Conne ctionStrings.Ad d(settings)
If encrypt Then
config.Connecti onStrings.Secti onInformation.P rotectSection(N othing)
End If
config.Save()
End Sub
HTH
Volker
"harry" wrote:
I've set my database connection as an Application.Set ting using the
designer.
Since Application.Set tings are read only, how do I change the connection
properties when deploying to another machine ?
Thanks
Harry