Convert DataSet and DataTable to Xml String helper functions

I created 2 helper functions(can be modified as extensions in .Net Framework 3.5) to output/trace content of DataSet  or DataTable
public static string ToStringAsXml(DataSet ds)

{

 StringWriter sw = new StringWriter();
ds.WriteXml(sw, XmlWriteMode.IgnoreSchema);

string s = sw.ToString();

return s;

}
 

public static string ToStringAsXml(DataTable dt)
{
 StringWriter sw = new StringWriter();
dt.WriteXml(sw, XmlWriteMode.IgnoreSchema);
string s = sw.ToString();
return s;

}

posted @ Thursday, August 14, 2008 12:02 AM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 2 and 2 and type the answer here:
 

Live Comment Preview:

 
«December»
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910