472,811 Members | 4,199 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Missing Row in DataSet

Still working on my XML DataSet...

Having moved on past difficult and complex problems, resolved with the
assistance of everyone here, I find myself facing yet another problem. My
XML document breaks the schema. There are missing tags everywhere, on
purpose I'm told, because we don't need them.

I'm getting a "System.Data: There is no row at position <row number>" error.
Hopefully I can workaround this issue. I need to find a way to keep going
past the missing row on to the next one, without throwing an exception.

Any suggestions?

--
Regards,

Fred Chateau
http://hotelmotelnow.com
May 25 '07 #1
3 2746
Your XML document breaks *what* schema? "There are missing tags everywhere"..
*what* missing tags are we talking about here?

If you are getting a "There is no row at position <row number>" error, it
may likely be because there aren't any rows at all, so looking for a
workaround to "get the next row" may be futile.

Suggest you practice a bit on how to make clearer posts so readers can be
more help.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Fred Chateau" wrote:
Still working on my XML DataSet...

Having moved on past difficult and complex problems, resolved with the
assistance of everyone here, I find myself facing yet another problem. My
XML document breaks the schema. There are missing tags everywhere, on
purpose I'm told, because we don't need them.

I'm getting a "System.Data: There is no row at position <row number>" error.
Hopefully I can workaround this issue. I need to find a way to keep going
past the missing row on to the next one, without throwing an exception.

Any suggestions?

--
Regards,

Fred Chateau
http://hotelmotelnow.com
May 25 '07 #2
Peter,

You are certainly correct. I was responding emotionally to the fact that
after spending a week developing a simple tool to transfer XML data to a
relational database, I finally got the tool working only to discover the XML
was bad. So, the tool is correctly reacting to the fact that the node it has
been instructed to find is not missing, but rather ambiguous.

I don't want to get too far off-topic, but a brief discussion of XML is in
order. An XML schema allows you to declare a node as optional, however not
all nodes can be optional. Is it one thing to declare a node at the top of a
hierarchy as optional. In that case, ADO responds by returning a DBNull for
the missing node. However, if a node that is within a certain hierarchy in
the document is declared as optional and is missing, it can no longer be
determined where the nodes above that node fit into the hierarchy. In that
case, ADO responds by returning the error : There is no record at position
<record numberor at least, that is what I believe is happening. It is
simply another way of saying that the node does not validate.

For example, take the most extreme case, of declaring a root node as
optional. If the root node is missing in the document, there basically is no
document to read. A good schema tool should not allow certain nodes to be
declared as optional, but if the schema is being written by hand, that case
can exist.

So, to return to the problem that I currently face is that I have an XML
document with 50,000 records, and a few of them are missing tags in
inappropriate places. ADO insists on dumping out of the loop when it gets to
an invalid node, so I'm stuck. I need to find a way to test for an invalid
node (missing record) and ignore it, or ignore the exception and continue on
to the next record.

I'm going to try simply removing the Using statement surrounding the loop
and see what happens. If that doesn't work, I need help.

--
Regards,

Fred Chateau
http://hotelmotelnow.com

"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:7C**********************************@microsof t.com...
Your XML document breaks *what* schema? "There are missing tags
everywhere"..
*what* missing tags are we talking about here?

If you are getting a "There is no row at position <row number>" error, it
may likely be because there aren't any rows at all, so looking for a
workaround to "get the next row" may be futile.

Suggest you practice a bit on how to make clearer posts so readers can be
more help.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Fred Chateau" wrote:
>Still working on my XML DataSet...

Having moved on past difficult and complex problems, resolved with the
assistance of everyone here, I find myself facing yet another problem. My
XML document breaks the schema. There are missing tags everywhere, on
purpose I'm told, because we don't need them.

I'm getting a "System.Data: There is no row at position <row number>"
error.
Hopefully I can workaround this issue. I need to find a way to keep going
past the missing row on to the next one, without throwing an exception.

Any suggestions?

--
Regards,

Fred Chateau
http://hotelmotelnow.com

May 26 '07 #3
Well, removing the Using statement didn't help so I think my next option is
to try an XmlTextReader, which brings up the question, do you need a
Try/Catch or Using statements surrounding an XmlTextReader?

--
Regards,

Fred Chateau
http://hotelmotelnow.com
"Fred Chateau" <we*******@hotelmotelnow.comwrote in message
news:el**************@TK2MSFTNGP06.phx.gbl...
Peter,

You are certainly correct. I was responding emotionally to the fact that
after spending a week developing a simple tool to transfer XML data to a
relational database, I finally got the tool working only to discover the
XML was bad. So, the tool is correctly reacting to the fact that the node
it has been instructed to find is not missing, but rather ambiguous.

I don't want to get too far off-topic, but a brief discussion of XML is in
order. An XML schema allows you to declare a node as optional, however not
all nodes can be optional. Is it one thing to declare a node at the top of
a hierarchy as optional. In that case, ADO responds by returning a DBNull
for the missing node. However, if a node that is within a certain
hierarchy in the document is declared as optional and is missing, it can
no longer be determined where the nodes above that node fit into the
hierarchy. In that case, ADO responds by returning the error : There is no
record at position <record numberor at least, that is what I believe is
happening. It is simply another way of saying that the node does not
validate.

For example, take the most extreme case, of declaring a root node as
optional. If the root node is missing in the document, there basically is
no document to read. A good schema tool should not allow certain nodes to
be declared as optional, but if the schema is being written by hand, that
case can exist.

So, to return to the problem that I currently face is that I have an XML
document with 50,000 records, and a few of them are missing tags in
inappropriate places. ADO insists on dumping out of the loop when it gets
to an invalid node, so I'm stuck. I need to find a way to test for an
invalid node (missing record) and ignore it, or ignore the exception and
continue on to the next record.

I'm going to try simply removing the Using statement surrounding the loop
and see what happens. If that doesn't work, I need help.

--
Regards,

Fred Chateau
http://hotelmotelnow.com

"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:7C**********************************@microsof t.com...
>Your XML document breaks *what* schema? "There are missing tags
everywhere"..
*what* missing tags are we talking about here?

If you are getting a "There is no row at position <row number>" error, it
may likely be because there aren't any rows at all, so looking for a
workaround to "get the next row" may be futile.

Suggest you practice a bit on how to make clearer posts so readers can be
more help.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Fred Chateau" wrote:
>>Still working on my XML DataSet...

Having moved on past difficult and complex problems, resolved with the
assistance of everyone here, I find myself facing yet another problem.
My
XML document breaks the schema. There are missing tags everywhere, on
purpose I'm told, because we don't need them.

I'm getting a "System.Data: There is no row at position <row number>"
error.
Hopefully I can workaround this issue. I need to find a way to keep
going
past the missing row on to the next one, without throwing an exception.

Any suggestions?

--
Regards,

Fred Chateau
http://hotelmotelnow.com


May 27 '07 #4

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

Similar topics

2
by: Todd | last post by:
This is my first time trying to take the results of a query that reside in a Dataset and convert the dataset into an xml file. Everything works great, except that my resulting XML file is missing...
5
by: Paul Nations | last post by:
I'm in a real pickle. I've inherited a project with major problems. It receives encrypted XML files from a website not under my control (so I can't modify the web app) for insertion into a...
2
by: Andrew | last post by:
Hey all, Have a strange one here, and being still fairly new to .NET isn't helping me understand it. I am having a problem where a DataReader doesn't return all the rows when I try to use a...
0
by: Chris | last post by:
I finally got my report to be recongized, that login issue is terrible. Using VS.NET 2003, created report inside of it. Now when I attempt to display the report is blank (missing data, though I can...
3
by: Belee | last post by:
I develop in VB.NET and the dataset that I create gets missing. Any help?
3
by: dekern | last post by:
Good afternoon all, I guess I am missing the benefit of using datasets with Crystal. For years I have written wrapper apps that used the Pull method and I let Crystal do all the sql work. Now...
0
by: Joe | last post by:
Hi I have a Typed Dataset (TDS) and am using the derived class. I wrote a wrapper Class around the TDS class to manipulate the class {Add,Delete, return Dataset etc} - All is fine except when I...
8
by: michael sorens | last post by:
I have written a few applications to read data from a database but now, as I turn my attention to writing to a database, I am apparently missing some fundamentals. I created a new database with...
4
by: =?Utf-8?B?VG9yZW4gVmFsb25l?= | last post by:
Was editing code, am getting the following errors } expected Type or namespace definition, or end-of-file expected Eyes crossed cannot find code below! using System; using...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.