Question on XML and Dataset

S

srini.venkatesan

I am creating an XML webservice where by I am sending the a string of
XML to the consumer.
The consumer receives the XML and converts into dataset and able to
update the rows to the database. The problem I am having is when I
create the intial dataset in XML web service, I use the ADO.net to
populate the dataset, as I have some columns having null values for
certain rows, especially datefields, those are not sent over in the XML
or dataset generated.
So while parsing the XML or traversing the dataset in the client side
for the date column, obviously I will get the error, I am not sure what
other ways I can do to prevent it.

I thought of adding codegen and Typed dataset, is that the only option,
even then I have to default to a certain value right ? Any help is
appreciated.
 
S

Scott M.

After the consumer reads the xml into a dataset, check for the existance of
the column(s) in question. Or, before sending the xml check it for the
existance of the columns. Checking the data is always the best way to
prevent problems.
 
R

Ramya A

Use Convert.IsDBNull method to check for null and then set the parsed
string from XML to vbnullstring while forming the dataset.

This works!

Ramya
 
S

Scott M.

That won't work if the column doesn't exist, only if the column exists but
there is no data value in the column.
 

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