Posted By

indra on 10/27/10


Tagged

ConnectionString AppConfig


Versions (?)

Change setting in app.config like connection string


 / Published in: VB.NET
 

URL: http://www.eggheadcafe.com/community/aspnet/14/10038785/modify-connectionstring-in-appconfig.aspx

  1. Dim XmlDoc As New XmlDocument()
  2.  
  3. XmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
  4. For Each xElem As XmlElement In XmlDoc.DocumentElement
  5. If xElem.Name = "appSettings" Then
  6. For Each xNod As XmlNode In xElem.ChildNodes
  7. If xNod.Attributes(0).Value = 'Something key' Then
  8. xNod.Attributes(1).Value = 'Something Value'
  9. End If
  10. Next
  11. End If
  12. Next
  13.  
  14. XmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)

Report this snippet  

You need to login to post a comment.