problem with DataSet.GetXml() method

  • Thread starter Thread starter lucky
  • Start date Start date
L

lucky

Hi guys!

i've filled the DatSet object and was trying to get xml data from it. i
used GetXml() method for that.
it worked fine when all columns of the datatable has data. it generates
perfectly fine xml but when if one column in datatable has no
data(null), the method doesnt generates xml for that column.

for example :

i've table in sql server database called temp1 which has 4 columns but
sometimes only 1,3 column has data and 2,4 column doesnt has data.
which looks like this

col1 col2 col3 col4
1 NULL 1 NULL

when i fetch data from the database into the dataset and try to get xml
of that data, it looks like this:

<NewDataSet>
<Temp1>
<col1>1</col1>
<col3>1</col3>
</Temp1>
</NewDataSet>

another thing that is happening in process is, after fetching the data
into the dataset i'm extracting the datatable from the dataset and
insert into another dataset and then i call the GetXml() method of the
dataset.

can anyone tell me what i'm missing or is there any other way to do
this?

thanks
Lucky
 
This is correct. You will then have to examine the XML for the existence of
a tag before attempting to extract the data in that tag.
 
Back
Top