向数据集添加多行XML,然后将其放入数据网格中
本文关键字:数据 数据网 网格 然后 添加 数据集 XML | 更新日期: 2023-09-27 18:04:47
我有以下代码(c#):
FinalXMLString = FinalXMLString + "<row " + xmlString + " />";
xmlString = "";
dataList.Clear();
}
StringReader streamreader = new System.IO.StringReader(FinalXMLString);
XmlTextReader xmlreader = new System.Xml.XmlTextReader(streamreader);
dataSet.ReadXml(xmlreader);
我的FinalXMLString看起来如下:
<row EntryID = '"1'" ManufacturerID = '"59'" Name = '"Conbraco hkhkhklh'" AuditDate = '"2/22/2013 10:22:46 AM'" SqlLogin = '"UNITED-SYSTEMS''jessical'" Application = '"G5;Desktop;admin'" ChangeType = '"U'" /><row EntryID = '"2'" ManufacturerID = '"59'" Name = '"Conbraco hkhkhklh'" AuditDate = '"3/18/2013 4:14:21 PM'" SqlLogin = '"uss2012SQL01'" Application = '"G5;Desktop;admin'" ChangeType = '"U'" />"
这是从调试器模式,所以反斜杠仍然在那里。问题是ReadXml每次都失败。上面的xml格式不正确吗?
根据该xml字符串有两个根元素。下面是FinalXmlString的一个简化示例:
<row />
<row />
尝试在行元素中包装这些元素示例:
<rows>
<row />
<row />
</rows>