Home All Groups Group Topic Archive Search About
Author
6 Mar 2006 1:40 PM
rzaleski
I want to create an application that reads an xml diagram.  Due to the
heirachical nature of xml, when I
read the file into a dataset, I get two tables.  Is there a way I can
flatten the tables, so I go from this:

Table1:

NAME
Ryan
Jake

Table2:

JOB        DATE
Paper        March
Homework    April
Other        May

To this:

NAME        JOB        DATE
Ryan        Paper        March
Ryan        Homework    April
Jake        Other        May

Also, I want to make sure I can save it in the proper format
(heirarchical).

Thanks.

Author
6 Mar 2006 3:30 PM
Cor Ligthert [MVP]
Rzaleski,

Not with one statement.

Have a look to this on our website

http://www.vb-tips.com/default.aspx?ID=5fd5a8cf-54dc-4946-a193-8a9529b2b38b

I hope this helps,

Cor

<rzale***@gmail.com> schreef in bericht
Show quoteHide quote
news:1141652405.888253.5510@z34g2000cwc.googlegroups.com...
>I want to create an application that reads an xml diagram.  Due to the
> heirachical nature of xml, when I
> read the file into a dataset, I get two tables.  Is there a way I can
> flatten the tables, so I go from this:
>
> Table1:
>
> NAME
> Ryan
> Jake
>
> Table2:
>
> JOB DATE
> Paper March
> Homework April
> Other May
>
> To this:
>
> NAME JOB DATE
> Ryan Paper March
> Ryan Homework April
> Jake Other May
>
> Also, I want to make sure I can save it in the proper format
> (heirarchical).
>
> Thanks.
>
Author
6 Mar 2006 3:58 PM
rzaleski
I understand how to do a relation in a datatable, but my problem is,
when the xml is read in, two tables are created.  These two tables do
not share a column.  One table has name and the other has job and date.

Ryan
Author
6 Mar 2006 4:05 PM
Cor Ligthert [MVP]
>I understand how to do a relation in a datatable, but my problem is,
> when the xml is read in, two tables are created.  These two tables do
> not share a column.  One table has name and the other has job and date.
>
And the sample has that as well, One table has the names and one table has
the states.

Cor
Author
6 Mar 2006 7:46 PM
rzaleski
You see, you are adding a column and creating the relation based on
that.  If I am fed an XML file, I do not know the relations beforehand.
Is there any other ways of doing this?  When I call
ds.ReadXML("myfile.mxl") it reads the data into 3 tables instead of one.
Author
7 Mar 2006 5:10 AM
Cor Ligthert [MVP]
rzaleski,

If you are absolute sure that the pairs are equal, than you can add to both
a column and loop through both and add the index as key (Internaly of
course).

Than you can use the showed sample.

I doubt that these two tables without key will work.

Cor
Author
7 Mar 2006 1:37 PM
rzaleski
I am getting the following error:

Cannot add a nested relation or an element column to a table containing
a SimpleContent column.