serializing dataset

  • Thread starter Thread starter sonicsoul
  • Start date Start date
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.
 
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.
 
Back
Top