清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("Content.xml")); //content.xml是自己所写的xml文件
XmlElement newElement = xmlDoc.CreateElement("留言板");
XmlElement elid = xmlDoc.CreateElement("id");
XmlElement elname = xmlDoc.CreateElement("name");
XmlElement elcomment = xmlDoc.CreateElement("comment");
XmlElement elback = xmlDoc.CreateElement("back");
elid.InnerText = ReturnCount();
elname.InnerText = this.name0.Text.Trim();
elcomment.InnerText = this.comment0.Text.Trim();
elback.InnerText = " ";
newElement.AppendChild(elid);
newElement.AppendChild(elname);
newElement.AppendChild(elcomment);
newElement.AppendChild(elback);
xmlDoc.DocumentElement.AppendChild(newElement);
xmlDoc.Save(Server.MapPath("Content.xml"));
Response.Redirect("View.aspx");
xmlDoc.Load(Server.MapPath("Content.xml")); //content.xml是自己所写的xml文件
XmlElement newElement = xmlDoc.CreateElement("留言板");
XmlElement elid = xmlDoc.CreateElement("id");
XmlElement elname = xmlDoc.CreateElement("name");
XmlElement elcomment = xmlDoc.CreateElement("comment");
XmlElement elback = xmlDoc.CreateElement("back");
elid.InnerText = ReturnCount();
elname.InnerText = this.name0.Text.Trim();
elcomment.InnerText = this.comment0.Text.Trim();
elback.InnerText = " ";
newElement.AppendChild(elid);
newElement.AppendChild(elname);
newElement.AppendChild(elcomment);
newElement.AppendChild(elback);
xmlDoc.DocumentElement.AppendChild(newElement);
xmlDoc.Save(Server.MapPath("Content.xml"));
Response.Redirect("View.aspx");