//读配置文件 XmlDocument doc = new XmlDocument(); doc.Load("blog.xml"); XmlNode url = doc.SelectSingleNode("博客/广告地址"); texturl.Text = url.InnerText; XmlNode Name = doc.SelectSingleNode("博客/用户名1"); name = Name.InnerText; XmlNode Password = doc.SelectSingleNode("博客/密码1"); password = Password.InnerText; XmlNode dbid = doc.SelectSingleNode("博客/DBID"); DBID = int.Parse(dbid.InnerText); //写配置文件 XmlDocument doc = new XmlDocument(); doc.Load("blog.xml"); XmlNode xiugai = doc.SelectSingleNode("博客"); xiugai["DBID"].InnerText = DBID.ToString(); //修改值 doc.Save("blog.xml");
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)