public static bool WirteConfigurationSetting(string name,string val)
{
XmlDocument doc = new XmlDocument();
doc.Load(ConfigInfoClass.ConfigFileName);
XmlNode root = doc.DocumentElement;
XmlNodeList xnl = doc.SelectNodes(string.Format("configuration/appSettings/add[@key='{0}']",name));
int Num = xnl.Count;
if(Num != 1) return false;
XmlNode node = xnl[0];
node.Attributes["value"].Value = val;
doc.Save(ConfigInfoClass.ConfigFileName);
return true;
}
{
XmlDocument doc = new XmlDocument();
doc.Load(ConfigInfoClass.ConfigFileName);
XmlNode root = doc.DocumentElement;
XmlNodeList xnl = doc.SelectNodes(string.Format("configuration/appSettings/add[@key='{0}']",name));
int Num = xnl.Count;
if(Num != 1) return false;
XmlNode node = xnl[0];
node.Attributes["value"].Value = val;
doc.Save(ConfigInfoClass.ConfigFileName);
return true;
}
浙公网安备 33010602011771号