473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Loading a dataset with XML that contains empty values

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

Jun 22 '07 #1
2 1854
Hi !

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

Regards,
Mihai

"TexasAggie96" <jr*********@msn.comwrote in message
news:11********************@m36g2000hse.googlegrou ps.com...
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

Jun 22 '07 #2
On Jun 22, 11:57 am, "Mihai" <bvel...@telus.netwrote:
Hi !

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

Regards,
Mihai

"TexasAggie96" <jrwallac...@msn.comwrote in message

news:11********************@m36g2000hse.googlegrou ps.com...
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- Hide quoted text -

- 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.

Jun 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
1
by: John | last post by:
Hi All, When I delete the last record from my dataset and then WriteXML() to the file; the Table itself, in the xml file, is removed. I need to prevent the table structure from being deleted if...
5
by: Jason | last post by:
I am having problems understanding how to access a datasource only once, fill a single dataset, and then reference that dataset multiple times through different user controls(ascx) found on the...
3
by: martin | last post by:
Hi, I am having trouble determining if my dataset is empty. I have function that populates a dataset from a database and then retuens it. If the database contains no data then the dataset will...
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
22
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty...
4
by: Al | last post by:
I have this scenario: 1. XML file with schema and data is created from SQL Server tables. XML file contains 6 tables, some of them have rows, some of them are empty. 2. XML file is given to the...
6
by: cmorgan76 | last post by:
This is a 2 part question: Part 1: I am accesing a web service that returns an xml string of user information. I am attempting to load the XML into an XMLDocument, save the document, load it...
20
by: Nickolai Leschov | last post by:
Hello all, I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices). The supplied library has .LIB and .H files. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.