Loading a dataset with XML that contains empty values

T

TexasAggie96

I am working on a project where I get a XML datastream back from an
application API which may contain a particular value that may be
emty. An example of this can be seen below

<?xml version="1.0" encoding="iso-8859-1" ?>
- <NamedProfileList>
- <NamedProfile>
<ProfileID>115280</ProfileID>
<Name>Generation|Aks G7|16316</Name>
<Type>Meter</Type>
<StartTime>2007-06-21T00:00:00</StartTime>
<StopTime>2007-06-21T01:00:00</StopTime>
<Value>0.000</Value>
</NamedProfile>
- <NamedProfile>
<ProfileID>115280</ProfileID>
<Name>Generation|Aks G7|16316</Name>
<Type>Meter</Type>
<StartTime>2007-06-21T01:00:00</StartTime>
<StopTime>2007-06-21T02:00:00</StopTime>
<Value />
</NamedProfile>
....
....
When loading the XML this value causes the dataset to throw an
exception because there is a NULL value there. My question is is
there a way to keep this NULL value from throwing an exception on the
load of the dataset? I have searched the web over for an answer and
have not found one. Thanks for any help offered.

James
 
M

Mihai

Hi !

You have to configure the columns of the table belonging to dataset to
accepts NULL values

Regards,
Mihai
 
T

TexasAggie96

Hi !

You have to configure the columns of the table belonging to dataset to
accepts NULL values

Regards,
Mihai








- Show quoted text -

Sorry about that... I should have said in the first post. The column
is a double and here are all of the properties for the column.
AllowDBNull = True
AutoIncrement = False
AutoIncrementSeed = 0
AutoIncrementStop = 1
Caption = Value
DataType = System.Double
DateTimeMode = UnspecifiedLocal
DefaultValue = 0
MaxLength = -1
NullValue = (Throw Exception)
ReadOnly = False
Unique = False
Name = Value

I try to change the NullValue parameter but this is disagreeable with
the class, just states that throw expection is the only value that can
be chosen. It would be nice to be able to load this data and have the
empty values default to zero.
 

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