You are here:   Blogs
Register   |  Login

Search

Minimize

PPG&A Blogs

Minimize
Mar 13

Written by: Phil Porter
3/13/2010 3:31 PM 

Output datatable to XML string
System.IO.StringWriter writer = new System.IO.StringWriter();
dataTable.WriteXml(writer, XmlWriteMode.WriteSchema, false);
string xmlFromDataTable = writer.ToString();

Use XmlWriteMode.WriteSchema to include the schema in the output.
 

Read XML into a dataset from an XML string
string strXML = "valid XML here";
System.IO.StringReader sr = new System.IO.StringReader(strXML);
System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader ( sr );
DataSet ds = new DataSet();
ds.ReadXml(xr);

Tags:

Archive

Minimize

WARRANTIES

Minimize

SOURCE CODE SAMPLES MAY BE INCLUDED IN SOME BLOGS. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Other marks and trade names used in this publication are the property of their respective owners.