problem with DataSet.GetXml() method

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
 
S

Scott M.

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.
 

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