null columns in a dataset

  • Thread starter Thread starter afsheen
  • Start date Start date
A

afsheen

Hi,

i have dataset that has few columns that are null. when i write
ds.GetXmlSchema( ) , i can see the names for those null columns
in the schema but when i write ds.GetXml( ) i find those nodes missing ,
when i do da.Update for inserting a new row , it throws an
error that columns is not present in tha dataset....

how can i have null values in my xml of the dataset

thanks
afsheen
 
Hi Afsheen,

That is a difference between writeXML and getXML, GetXML does not writes
dataset and/or dbnull information.

Cor
 
Hi,

You need to keep schema in this case. This is expected result. When dataSet
saves data into the XML file it ignores NULL values and does not save them.
If your column in a datatable does not have value in at least one row, then
basically the whole column will be missing in a saved XML. Then, later on
when you open saved XML, DataSet will not find this column and you could be
in a trouble. Saving Schema together with the XML data, will make you sure
that everything is OK
 
Hi Val,

The OP uses GetXML.

Do you have the syntax to get the schema in the string using GetXML.

I could not find it anywhere and therefore I am curious what I mis?

Cor
 
Hi,

I probably need to extend my posting in this case. GetXml method is
identical to the WriteXml, but it has default of IgnoreSchema. What you need
to do is to use WriteXml directly, then you could specify to ignore schema
saving or not
 
Back
Top