Convert C# 2.0 System.Data.SqlTypes.SqlXml object into a System.Xml.XmlNode

懵懂的女人 提交于 2019-12-06 05:05:23

I ended up not having to use it, but I found what I think is the best answer. Basically you load an XmlReader, create an XmlDocument from the reader, then select a list of nodes from the document into an XmnLodeList, which you can use in a ForEach statement. Here is some sample code:

System.Xml.XmlReader sqlXMLReader = sqlComm.ExecuteXmlReader();
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(sqlXMLReader);
System.Xml.XmlNodeList xnlJobs = xmlDoc.SelectNodes("/job");

Still convoluted as hell, but at least there are no xml to string to xml conversions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!