Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
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 on Thursday, August 14, 2008 12:02 AM .Net Framework | Back to top


Comments on this post: Convert DataSet and DataTable to Xml String helper functions

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
Hi,
I did the same thing (converitng DataTable to Database). It is not working for the DataTable that i get from Database but works for DataTable constructed by me. Any clue to this problem???
Left by Sandip on Dec 27, 2008 6:29 PM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
Hi,
I resolved the Problem. I converted DataTable to Database and it started working fine.
Left by Sandip on Dec 27, 2008 6:35 PM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
can any body say me how to convert XML string to data set
Left by yogesh on Aug 18, 2009 8:19 AM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
Muito interessante o post.
Left by Alessandro Gonzalez on Oct 26, 2009 2:22 PM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
How to eliminate the special character in the xml the space is replaced my _x0020_ in the xml any clues
Left by Jagadeesh.k on Aug 31, 2012 9:26 PM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
I've used datatable to xml string. After executing the method consecutively. I received the system out of memory exception error. Is there any way to get rid of it?.
Left by Sathish on Oct 10, 2013 3:52 PM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
no puedo convertir un datatable a XML
Left by Jorge on Mar 05, 2015 2:29 AM

# re: Convert DataSet and DataTable to Xml String helper functions
Requesting Gravatar...
Cannot serialize the DataTable. DataTable name is not set.
Left by rohit on Feb 22, 2017 10:43 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net