473,414 Members | 1,671 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,414 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 2795
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.