当使用ExecuteXmlReader()时,如何访问第二个,通常我会使用NextResult(),但Xml.XmlReader不提供。
SQL
select * from table1 for xml auto
select * from table2 for xml auto
C#
using (System.Xml.XmlReader xmlReader = cmd.ExecuteXmlReader())
{
while (xmlReader.Read())
{
while (xmlReader.ReadState != System.Xml.ReadState.EndOfFile)
{
result = xmlReader.ReadOuterXml();
}
//do something with each result
}
}