Hi, I'm tring to get a string from a DataSet without using GetXml. I'm using WriteXml, instead. How to use it to get a string? Thanks
+4
A:
Write to a StringWriter
, and then call ToString
on that.
Note that if you want the generated XML declaration to specify UTF-8 instead of UTF-16, you'll need something like my Utf8StringWriter
.
Jon Skeet
2009-06-08 08:26:58
+5
A:
StringWriter sw = new StringWriter();
dataSet.WriteXml(sw);
string result = sw.ToString();
Mehrdad Afshari
2009-06-08 08:27:27