我用下面这句读取配置
strServerName = System.Configuration.ConfigurationSettings.AppSettings["ServerName"];
假如我想通过程序修改配置,应该怎么改?
strServerName = System.Configuration.ConfigurationSettings.AppSettings["ServerName"];
假如我想通过程序修改配置,应该怎么改?
解决方案 »
- 图像识别 与 对比
- C# FTP批量下载文件的问题
- 谁能帮帮我。c#调用c++dll问题
- C# 程序员新手 从哪里学起
- open remote server file
- ”未将对象引用设置到对象的实例“ 这是什么原因,请高手指点
- 怎样在C#中将int转换成byte array ,将byte array 转成int值
- c# 在主界面弹出登录框(利用委托事件实现)
- c#图形绘制
- 急!!!在SqlDataReader reader中.读取数据库数据,如第一列是bigint型,应该是reader.Get???(0),怎么取得数据?(
- 急,C#中发送数据到url及如何接受指定url中的数据?
- 请问dataview导EXCEL一定是要系统装的是office2000吗?2003行吗 ?怎么实现?谢谢!
/// 修改config文件节点属性。
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Key">键</param>
/// <param name="Value">值</param>
public bool UpdateConfig(string Path,string Key,string Value)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load(Path);
XmlNode node = doc.SelectSingleNode(Key);
XmlElement ele = (XmlElement)node;
ele.SetAttribute("value",Value);
doc.Save(Path);
return true;
}
catch{return false;}
}