Serialize a dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do a serialize a dataset?
I tried
string buf;
buf = mydataset.GetXml();
I got the data but no Schema.
There is a GetXmlSchema, but I want everything together.
Can I append the dataset string to the schema string and get a complete
dataset?
 
This will give you the schema:

StringWriter writer = new StringWriter();
XmlSerializer ser = new XmlSerializer(typeof(DataSet));
ser.Serialize(writer, dataSet);
return writer.ToString();
 
Back
Top