String xmlString = loaddata; System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(new System.IO.StringReader(xmlString)); reader.Read(); System.Data.DataSet dsData = new System.Data.DataSet(); dsData.ReadXml(reader, System.Data.XmlReadMode.Auto); reader.Close();
if (dsData.Tables.Count > 0) { if (dsData.Tables[0] == null) { reader = new System.Xml.XmlTextReader(new System.IO.StringReader(xmlString)); reader.Read(); dsData = new System.Data.DataSet(); dsData.ReadXml(reader, System.Data.XmlReadMode.Auto); reader.Close(); } }
System.Data.XmlReadMode.ReadSchema
System.Data.XmlReadMode.Auto
reader.Read();
DataSet
if(dsData !=null && dsData.Tables.Count > 0) { //do other stuff }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)