Hi,

I have a question need your help. I have defined a dataset with two tables
and I also defined a relationship between the two tables. one is Order
another is OrderDetail. I loaded 3 order records and its related order
detail records, when I use .WriteXml() to write out the data, it actually
output 2 order records first and the output all order details altogether
like:

<MyDataSet>
<Order />
<Order />
<Order />
<OrderDetail />
<OrderDetail />
<OrderDetail />
<OrderDetail />
<OrderDetail />
</MyDataSet>

How could I get the xml like:

<MyDataSet>
<Order>
<OrderDetail />
<OrderDetail />
</Order>
<Order>
<OrderDetail />
</Order>
<Order>
<OrderDetail />
<OrderDetail />
</Order>
</MyDataSet>

Thanks very much!
John

Re: DataSet.WriteXml by http://www

http://www
Fri Sep 10 19:37:53 CDT 2004

John:

You could reverse engineer the whole process.

Load the second schema using DataSet.ReadXml into a new dataset and you will
haev the correct table structure and dataset.

Then import your order and order detail records from the other dataset.

There are probably other ways and better ways to do this, but this would
work :)

--
forum member
http://www.visual-basic-data-mining.net/forum


"John Lee" <john.nospam@pursca.com> wrote in message
news:%23rKSw9ulEHA.396@tk2msftngp13.phx.gbl...
> Hi,
>
> I have a question need your help. I have defined a dataset with two tables
> and I also defined a relationship between the two tables. one is Order
> another is OrderDetail. I loaded 3 order records and its related order
> detail records, when I use .WriteXml() to write out the data, it actually
> output 2 order records first and the output all order details altogether
> like:
>
> <MyDataSet>
> <Order />
> <Order />
> <Order />
> <OrderDetail />
> <OrderDetail />
> <OrderDetail />
> <OrderDetail />
> <OrderDetail />
> </MyDataSet>
>
> How could I get the xml like:
>
> <MyDataSet>
> <Order>
> <OrderDetail />
> <OrderDetail />
> </Order>
> <Order>
> <OrderDetail />
> </Order>
> <Order>
> <OrderDetail />
> <OrderDetail />
> </Order>
> </MyDataSet>
>
> Thanks very much!
> John
>
>



re:DataSet.WriteXml by punis

punis
Fri Sep 10 08:02:59 CDT 2004

John,

If you are using a DataRelation set the Nested property to True. This
will acheive the effect you deisre.

Thanks,

Steve


Re: DataSet.WriteXml by CraigGoogle

CraigGoogle
Fri Sep 10 08:41:15 CDT 2004

You're so close! The DataRelation class has a .Nested property.

-- Craig Yellick, Alto

"John Lee" <john.nospam@pursca.com> wrote in message news:<#rKSw9ulEHA.396@tk2msftngp13.phx.gbl>...
> Hi,
>
> I have a question need your help. I have defined a dataset with two tables
> and I also defined a relationship between the two tables. one is Order
> another is OrderDetail. I loaded 3 order records and its related order
> detail records, when I use .WriteXml() to write out the data, it actually
> output 2 order records first and the output all order details altogether
> like:
>
> <MyDataSet>
> <Order />
> <Order />
> <Order />
> <OrderDetail />
> <OrderDetail />
> <OrderDetail />
> <OrderDetail />
> <OrderDetail />
> </MyDataSet>
>
> How could I get the xml like:
>
> <MyDataSet>
> <Order>
> <OrderDetail />
> <OrderDetail />
> </Order>
> <Order>
> <OrderDetail />
> </Order>
> <Order>
> <OrderDetail />
> <OrderDetail />
> </Order>
> </MyDataSet>
>
> Thanks very much!
> John