请大家帮忙,我用 XmlTextReader 加载了一个 xml 文件,如何把它写道一个 datatable 中。

dajingang 2004-11-20 08:15:37
我想把 XmlTextReader 的 xml 文件内容,填充到一个 dataset 或者 datatable中,不知如何做。
请大家帮忙。
...全文
148 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jeff20040819 2004-11-21
  • 打赏
  • 举报
回复
顶 接分
cnhgj 2004-11-20
  • 打赏
  • 举报
回复
DataSet newDataSet = new DataSet("New DataSet");

// Read the XML document back in.
// Create new FileStream to read schema with.
System.IO.FileStream fsReadXml = new System.IO.FileStream
(xmlFilename, System.IO.FileMode.Open);
// Create an XmlTextReader to read the file.
System.Xml.XmlTextReader myXmlReader =
new System.Xml.XmlTextReader(fsReadXml);
// Read the XML document into the DataSet.
newDataSet.ReadXml(myXmlReader);
// Close the XmlTextReader
myXmlReader.Close();

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧