I am using VS 2005. I have a situation where I need to store multiple connection strings in the app.config. I am reading the config file "DBConfigUIDemo.vshost.exe.config" using the following line
_config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Then I read _config.ConnectionStrings property and make modifications.
I use the following to save the config file
For Each Item As DBConfigurationItem In ConnectionStringsCollection
Dim index As Integer = _config.ConnectionStrings.ConnectionStrings.IndexOf(Item.GetConnectionStringSetting())
If index > -1 Then
_config.ConnectionStrings.ConnectionStrings(index) = Item.GetConnectionStringSetting()
Else
_config.ConnectionStrings.ConnectionStrings.Add(Item.GetConnectionStringSetting())
End If
Next
_config.Save(System.Configuration.ConfigurationSaveMode.Full)
*Item in the above is a custom object which gets the connection string setting.
When I hit save, the connectionstring settings are saved. but when I close my application (after saving) all my changes are lost.
My first thought was may be it was transactional so I am assigning dialogresult for my UI to be OK and closing the form.
Any Ideas Anyone.
All Help is Great Help.
Thanks
Sharon
[Non-text portions of this message have been removed]
SPONSORED LINKS
| Object oriented | Programming languages |
YAHOO! GROUPS LINKS
- Visit your group "AspNet2" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

