PC Review


Reply
Thread Tools Rate Thread

DataSet.WriteXml

 
 
John Lee
Guest
Posts: n/a
 
      10th Sep 2004
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


 
Reply With Quote
 
 
 
 
ciroque
Guest
Posts: n/a
 
      10th Sep 2004
John,

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

Thanks,

Steve

 
Reply With Quote
 
Craig Yellick
Guest
Posts: n/a
 
      10th Sep 2004
You're so close! The DataRelation class has a .Nested property.

-- Craig Yellick, Alto

"John Lee" <(E-Mail Removed)> wrote in message news:<#(E-Mail Removed)>...
> 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

 
Reply With Quote
 
http://www.visual-basic-data-mining.net/forum
Guest
Posts: n/a
 
      11th Sep 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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet.WriteXml Rastko Soskic Microsoft ADO .NET 1 20th Sep 2006 12:48 PM
DataSet.WriteXml() Steve B. Microsoft Dot NET Framework 4 28th Apr 2006 10:35 AM
dataset.writeXml Christina Androne Microsoft C# .NET 2 4th Nov 2005 11:41 AM
Filling a Dataset and Dataset.WriteXML method.. Serdar C Microsoft C# .NET 3 31st Dec 2004 09:07 AM
dataset.writexml using dtd judy Microsoft C# .NET 1 31st Jul 2003 05:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:26 AM.