DataSet.ReadXml and "Input string was not in a correct format."

G

Guest

Hi

I have a strongly typed dataset which I am trying to populate with data from
an XML document. I am getting the error:

Input string was not in a correct format.

The problem is that one of the columns in one of the dataset's tables is of
type double:

<xs:element name="TotalBalance" type="xs:double" minOccurs="0" />

The XML document that I am being sent contains an empty element for this
column:

<TotalBalance></TotalBalance>

Obviously an empty string, which is how the above element is being
interpreted, can not be cast to a double. There many similar instances in the
documents that I am receiving.

Is there a simple way of telling my dataset to ignore such empty elements
for value types? I could parse and clean the XML myself prior to calling
ReadXml() but I really don't want to do that.

Thanks
Amir
 

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