XML Document


private void UpdateConfigData()
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

//Looping through all nodes.
foreach (XmlNode node in doc.ChildNodes.Item(1))
{
//Searching for the node “”
if (node.LocalName == “dataConfiguration”)
{
node.Attributes[1].Value = “db1”; // ใส่ค่าที่ต้องการแก้ไข
}
}
//Saving the Updated values in App.config File.Here updating the config
//file in the same path.
doc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
}

มีแบบที่น่าสนใจ กด

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: