日期:2014-04-14 浏览次数:20893 次
System.Diagnostics.Debug.WriteLine(sSQL);
// Execute the SQL statement and return the data to an XmlReader
XmlReader oXml = oCmd.ExecuteXmlReader();
// Read the Schema of the XML
oDs.ReadXmlSchema(oXml);
// Read the XML fragment (which needs a schema)
oDs.ReadXml(oXml, XmlReadMode.Fragment);
}
oDs.DataSetName = "root";
// Write the XML out to a file
oDs.WriteXml(sPath + sFile);
return "Wrote XML to file " + sFile;
}
方法中的 sSQL 是含有 FOR XML 的SQL 语句