Importing XML into ADO.NET Dataset Problem

G

Guest

I have some xml from a company that usees the same xml tag underneath
different nodes. The xml is valid, but ADO.net complains when I try to load
it into a dataset. It gives me the error:

Although this XML document is well formed, it contains structure that Data
view cannot display.
The same table (Table name) cannot be the child table in two nested
relations.

I get the same error when I try to load up the xml document into the visual
studio .net IDE and browse the data through the GUI.

Microsoft has a knowledge base article about this, but doesn't say how to
resolve it. kb article
http://support.microsoft.com/default.aspx?scid=kb;en-us;325696

Here is the sample xml file, it has two item nodes underneath different
parent nodes and I need to be able to load up this xml in a dataset for
display purposes. Does anyone have any idea how to acomplish this?

Thanks!
-----------------------------------------------------------
<?xml version="1.0" ?>
<OrdersInventoryData>
<Order>
<Item>
<id>1</id>
<qty>5</qty>
</Item>
</Order>
<Inventory>
<Item>
<id>1</id>
<qty>100</qty>
</Item>
</Inventory>
</OrdersInventoryData>
-----------------------------------------------------------
 
G

Guest

As a quick solution, consider walking the XML and changing Item, under one of
the two tables, to another name. I will look at other solutions a bit later.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

What is the code you are using to load it into a dataset? I use the
dataset.ReadXml() method and it complains that "The same table (Item) cannot
be the child table in two nested relations."

I am using:
Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Frame work 1.1 Version 1.1.4322 SP1
 
G

Guest

I'm not sure if my previous post worked, so here it is again:
I use the dataset.ReadXml method to load the xml into the dataset.
The error I receive is: "The same table (item) cannot be teh child table in
two nested realtions"

How are you loading the XML into the ADO.NET dataset?

I am using:
Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Framework 1.1 Version 1.1.4322 SP1
 
G

Guest

Do you have .NET framework 2.0 installed and the IDE using it?

If so, how did you get the devlopment environment editor to use .NET frame
2.0 instead of 1.1?
 
S

Sahil Malik

Yes I have VS2005 installed.

- SM

Michael Kuzminski said:
Do you have .NET framework 2.0 installed and the IDE using it?

If so, how did you get the devlopment environment editor to use .NET frame
2.0 instead of 1.1?
 
G

Guest

Is there anyway to make it work with VS2003?? I have crystal reports embedded
in VS2003 and if I dl VS2005 I will lose that functionality.
 
S

Sahil Malik

Without VS2003 in front of me, I cannot give you actual code. But I know
it's possible to do by specifying the right schema using ReadXmlSchema ..
before doing the ReadXml.

BTW, what do you mean by "if I dl VS2005 I will lose that functionality." ?
Can you elaborate on how exactly are you using the Crystal Report in VS2003?

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
G

Guest

Does VS2005 beta download come with Crystal Reports functionality? I didn't
believe it did. Anyways, even if it did, I am not sure about deploying an
application on a beta build of software. Makes me feel a bit uneasy. Am I
overreacting?
 
S

Sahil Malik

Yes you can do Crystal Reports in VS2005.
Beta2 of VS2005 - slated to be out in Feb 2005, will come with a GoLive
license.

Unless you are running something critical like a nuclear warhead, or a
cruise missile - then I think you are overreacting. :)

Especially with .NET, when the code is de-compilable, I'd encourage you to
try it out. Even if you do run into a kink, there are always work arounds -
until RTM. And hey even in RTM we do workarounds at times.

It's software - it'll never be perfect :) - which is why I'll always have a
job LOL.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 

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