public string ConvertToXml(DataSet ds)
{
// This is the final document
XmlDocument Data = new XmlDocument();
// Create a string writer that will write the Xml to a string
StringWriter stringWriter = new StringWriter();
// The Xml Text writer acts as a bridge between the xml stream and the text stream
XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
// Now take the Dataset and extract the Xml from it, it will write to the string writer
ds.WriteXml(xmlTextWriter);
// Write the Xml out to a string
return stringWriter.ToString();
}
{
// This is the final document
XmlDocument Data = new XmlDocument();
// Create a string writer that will write the Xml to a string
StringWriter stringWriter = new StringWriter();
// The Xml Text writer acts as a bridge between the xml stream and the text stream
XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
// Now take the Dataset and extract the Xml from it, it will write to the string writer
ds.WriteXml(xmlTextWriter);
// Write the Xml out to a string
return stringWriter.ToString();
}
No comments:
Post a Comment