private void button1_Click(object sender, EventArgs e)
{
string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml";
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlpath);
MessageBox.Show(xmlpath);
XmlNodeList nlist = xmldoc.SelectNodes("Mjdesign/serverset");
if (nlist != null)
{
foreach (XmlNode msnode in nlist)
{
XmlNodeList mlist = msnode.ChildNodes;
foreach (XmlNode nsnode in mlist)
{
if (nsnode.Name == "datasource")
{
XmlElement xe = (XmlElement)nsnode;
xe.InnerText = textBox1.Text;
nsnode.InnerText = textBox1.Text;
xmldoc.Save(xmlpath);
//label6.Text = t_data;
MessageBox.Show(textBox1.Text);
}
if (nsnode.Name == "sa")
{
XmlElement xe = (XmlElement)nsnode;
xe.InnerText = textBox2.Text;
nsnode.InnerText = textBox2.Text;
xmldoc.Save(xmlpath);
//MessageBox.Show(dwmc.Text);
}
if (nsnode.Name == "sapwd")
{
XmlElement xe = (XmlElement)nsnode;
xe.InnerText = textBox3.Text;
nsnode.InnerText = textBox3.Text;
xmldoc.Save(xmlpath);
}
}
}
}
MessageBox.Show("设置成功");
}