如何将winform中填写的参数传递给xml xml又是如何接收呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个问题很简单.XmlDocument doc=new XmlDocument();doc.load(xml路径);XmlNode root=doc.SelectSingleNode("Setup");XmlElement xe=doc.CreateElement("Path");xe.SetAttribute("Folder",textBox1.Text.Trim());xe.InnerText=textBox2.Text.Trim();.AppendChild(xe);doc.Save(path);大概写了一下.你自己看着办吧. private bool InsertSqlStr() { if(SqlStr.Text != "") { XmlDocument myXmlDocument = new XmlDocument(); myXmlDocument.Load("NewTemplet.xml"); XmlElement myelement = myXmlDocument.CreateElement("values"); myelement.InnerText = SqlStr.Text; XmlAttribute myattribute = myXmlDocument.CreateAttribute("vname"); myattribute.Value = ParaValue.Text.Substring(0,ParaValue.Text.IndexOf(",")); myelement.Attributes.Append(myattribute); myXmlDocument.SelectSingleNode("//sql").AppendChild(myelement); myXmlDocument.Save("NewTemplet.xml"); return true; } return false; } 上面的乱了,再发一次。private bool InsertSqlStr(){if(SqlStr.Text != ""){XmlDocument myXmlDocument = new XmlDocument();myXmlDocument.Load("NewTemplet.xml");XmlElement myelement = myXmlDocument.CreateElement("values");myelement.InnerText = SqlStr.Text;XmlAttribute myattribute = myXmlDocument.CreateAttribute("vname");myattribute.Value = ParaValue.Text.Substring(0,ParaValue.Text.IndexOf(","));myelement.Attributes.Append(myattribute);myXmlDocument.SelectSingleNode("//sql").AppendChild(myelement);myXmlDocument.Save("NewTemplet.xml");return true;}return false;} 关于C#的游戏开发 WPF NavigationWindow启动白屏问题 textbox 怎么感知内容的变化 为什么无法触发OnKeyPress和OnKeyDown方法? 急!怎样在linux下配置C#开发的站点 调用对象的方法 就是在给对象发送请求!!1 ListView 问题 小问题,如何在.net中获得oracle中某个表的 sequence.nextval ? 我做了一个商业项目,都结束了,可是我忘了怎么让项目脱离visstudio独自运行了?急急急急急!!! 一个奇怪的画图问题 让dataGrid1使得显示的日期字段带时间 操作已超时这么处理 如何可以时间加长 不出现这样的错误
XmlDocument doc=new XmlDocument();
doc.load(xml路径);
XmlNode root=doc.SelectSingleNode("Setup");
XmlElement xe=doc.CreateElement("Path");
xe.SetAttribute("Folder",textBox1.Text.Trim());
xe.InnerText=textBox2.Text.Trim();
.AppendChild(xe);
doc.Save(path);
大概写了一下.你自己看着办吧.
{
if(SqlStr.Text != "")
{
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load("NewTemplet.xml");
XmlElement myelement = myXmlDocument.CreateElement("values");
myelement.InnerText = SqlStr.Text;
XmlAttribute myattribute = myXmlDocument.CreateAttribute("vname");
myattribute.Value = ParaValue.Text.Substring(0,ParaValue.Text.IndexOf(","));
myelement.Attributes.Append(myattribute);
myXmlDocument.SelectSingleNode("//sql").AppendChild(myelement);
myXmlDocument.Save("NewTemplet.xml");
return true;
}
return false;
}
private bool InsertSqlStr()
{
if(SqlStr.Text != "")
{
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load("NewTemplet.xml");
XmlElement myelement = myXmlDocument.CreateElement("values");
myelement.InnerText = SqlStr.Text;
XmlAttribute myattribute = myXmlDocument.CreateAttribute("vname");
myattribute.Value = ParaValue.Text.Substring(0,ParaValue.Text.IndexOf(","));
myelement.Attributes.Append(myattribute);
myXmlDocument.SelectSingleNode("//sql").AppendChild(myelement);
myXmlDocument.Save("NewTemplet.xml");
return true;
}
return false;
}