serializing dataset

S

sonicsoul

Hello,
In my custom control, i am providing serialization / deserialization of
dataset and noticed that, when a dataset table is empty, it will not be
serialized. (no xml is generated for empty tables using ds.GetXml or
ds.WriteXml)


Example:
DataSet ds = GetData();
ds.Tables.Count<enter>
3
ds.Tables[0].Rows.Count<enter>
0
SerializeMyDs( ds );

DeserializeMyDs( ds );
ds.Tables.Count<enter>
2

reason being is that i use ds.WriteXml( stringwriter ) to serialize it.

and that does not show anything for empty tables.

i would like to figure out a way to serialize my dataset so that it is
deserialized complete with empty tables.
 
J

Jason

In my custom control, i am providing serialization / deserialization of
dataset and noticed that, when a dataset table is empty, it will not be
serialized. (no xml is generated for empty tables using ds.GetXml or
ds.WriteXml)
When you do your WriteXML, have you tried using the write mode
XmlWriteMode.WriteSchema? This may at least give you schema output.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top