XML generated from a Dataset with a DataRelation

M

Me

Hi,

I have a dataset with two tables (Order, Item) and a
relationship setup to join the tables. I have the nested
property of the DataRelation class set to true. When I
use the GetXML method the XML looks like this:

<Orders>
<Order>
<OrderID>1</OrderID>
<Item>
<ItemID>1</ItemID>
</Item>
<Item>
<ItemID>2</ItemID>
</Item>
</Order>
</Orders>

But the XML I want it to produce would lokk like this:

<Orders>
<Order>
<OrderID>1</OrderID>
<Items>
<Item>
<ItemID>1</ItemID>
</Item>
<Item>
<ItemID>2</ItemID>
</Item>
</Items>
</Order>
</Orders>

Is there way to force the Dataset to give me the XML with
the <Items> and </Items> tags using the GetXML method? If
not, how would I go about generating the XML the way I
want it? I don't have to traverse the Dataset and
generate it myself do I?
 

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