Null value from dataset

G

Guest

I have one dataset populated with data
When I am using GetXML() method of this dataset, I am getting the XML representation o
the data. But, if a database field has Null value, then that node is not occuring in th
XML string
How to get that node in XML?
(I don't want to use ISNULL in SELECT query while populating dataset.)
 
G

Guest

It depends if you need to be able to differentiate between null and empty/zero/blank values
The reason why nulls show up as missing nodes/attributes is because they are different than non-null empty values. But if your particular case doesn't need to differentiate null values then your best bet is to do what you don't want to - wrap the null able columns with ISNULL. If you don't want to modify the SELECT statement in SQL, you could create an XSL and apply a transformation to the XML such that it fills in the missing nodes

Another simple solution would be to wrap some error handling logic around your call to get a value from a node to return some default value when the node is null

This posting is provided "AS IS" with no warranties, and confers no rights
 

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