null columns in a dataset

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
 
C

Cor

Hi Afsheen,

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

Cor
 
V

Val Mazur

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
 
C

Cor

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
 
V

Val Mazur

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
 

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