<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="userID" value="001" />
<add key="userName" value="admini" />
</appSettings>
</configuration>
[此贴子已经被作者于2007-3-9 23:41:11编辑过]
//更新指定节点
public bool UpdateXmlFile(string Filed, string FiledValue, string FileName)
{
try
{
XmlDocument xd = new XmlDocument();
xd.Load(FileName);
XmlNode node = xd.FirstChild;
foreach(XmlNode de in node.ChildNodes)
{
if(de.Name == Filed)
{
de.InnerText = FiledValue;
xd.Save(FileName);
break;
}
}
return true;
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message);
return false;
}
}