标签:div XML head class new declare data amp from
private void addBugCommentToDB(string header, string text) { string xmlContent = myManageDB.getDataFromCell("bugComment", "BugManager", "bugID", myCurrentBugNo); XDocument xml = null; if (xmlContent != null && xmlContent != "") { StringReader myReader = new StringReader(xmlContent); XDocument xdoc = XDocument.Load(myReader); XElement root = xdoc.Element("Tree"); XElement e = CreateElement(header, text); root.Add(e); xml = xdoc; } else { XDeclaration dec = new XDeclaration("1.0", "utf-8", "yes"); XDocument xdoc = new XDocument(dec); XElement root = new XElement("Tree"); XElement e = CreateElement(header, text); root.Add(e); xdoc.Add(root); xml = xdoc; } string sql = "declare @xmlDoc xml;set @xmlDoc =‘" + xml + "‘update BugManager set bugComment = @xmlDoc where bugID =‘" + myCurrentBugNo + "‘"; myManageDB.saveXML(sql); } private XElement CreateElement(string header, string text) { return new XElement("Node", new XAttribute("Name", header), new XAttribute("Text", text) ); } private void loadBugComment() { string xmlContent = myManageDB.getDataFromCell("bugComment", "BugManager", "bugID", myCurrentBugNo); if (xmlContent != null && xmlContent != "") { StringReader myReader = new StringReader(xmlContent); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(myReader); LoadXml myLoadXml = new LoadXml(); foreach (XmlNode node in xmlDoc.DocumentElement.ChildNodes) { string header = node.Attributes["Name"].Value; string text = node.Attributes["Text"].Value; addBugComments(header, text); } } }
标签:div XML head class new declare data amp from
原文地址:https://www.cnblogs.com/haizhibin1989/p/10061695.html