Return to Snippet

Revision: 34682
at October 27, 2010 04:18 by indra


Updated Code
Dim XmlDoc As New XmlDocument()

XmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
   For Each xElem As XmlElement In XmlDoc.DocumentElement
	If xElem.Name = "appSettings" Then
		For Each xNod As XmlNode In xElem.ChildNodes
			If xNod.Attributes(0).Value = 'Something key' Then
				xNod.Attributes(1).Value = 'Something Value'
			End If
		Next
	End If
Next

XmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)

Revision: 34681
at October 27, 2010 04:17 by indra


Initial Code
Dim XmlDoc As New XmlDocument()
           XmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
           For Each xElem As XmlElement In XmlDoc.DocumentElement
            If xElem.Name = "appSettings" Then
                For Each xNod As XmlNode In xElem.ChildNodes
                    If xNod.Attributes(0).Value = 'Something key' Then
                        xNod.Attributes(1).Value = 'Something Value'
                    End If
                Next
            End If
        Next
       XmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)

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

Initial Description

                                

Initial Title
Change setting in app.config like connection string

Initial Tags

                                

Initial Language
VB.NET