Get XML from typed dataset

G

Guest

Hi,
I was using Typed Dataset in VB.NET to generate XML file.
I difined XSD file( named customer_order_info) to include three tables,
let's say customers, orders and order_details. I also defined relationship
between customers and orders, orders and order_details.( customerid is PK in
customers, orderid is PK in orders, orderid and productid are PK in
order_details).
In my VB.NET code, I declared a variable as the XSD(customer_order_info),
declared a adapter to populate it(some common routines to get dataset). the
select command is a stored procedure which will retuen 3 recordsets. I also
defined table mappings when I populated the dataset. After I got the dataset,
I call ds.getXML to get xml file. I was able to get the file with correct
content, but the format is wrong. For eample, the format should be as follows:
<customer customerid=â€aaa†name=â€bill†phone=â€123345456†>
<order orderid=â€1011†customerid=â€aaa†shipname=â€Du monde entireâ€>
<order_detail orderid=â€1011†productid=â€tool1†quantity=â€12â€/>
<order_detail orderid=â€1011†productid=â€tool2†quantity=â€20â€/>
<order_detail orderid=â€1011†productid=â€tool3†quantity=â€30â€/>
</order>
<order orderid=â€1012†customerid=â€aaa†shipname=â€Du monde entireâ€>
<order_detail orderid=â€1012†productid=â€tool4†quantity=â€12â€/>
<order_detail orderid=â€1012†productid=â€tool2†quantity=â€20â€/>
<order_detail orderid=â€1012†productid=â€tool5†quantity=â€30â€/>
</order>
</customer>

But I got :
<customer customerid=â€aaa†name=â€bill†phone=â€123345456†>
<order orderid=â€1011†customerid=â€aaa†shipname=â€Du monde entireâ€/>
<order orderid=â€1012†customerid=â€aaa†shipname=â€Du monde entireâ€/>
<order_detail orderid=â€1011†productid=â€tool1†quantity=â€12â€/>
<order_detail orderid=â€1011†productid=â€tool2†quantity=â€20â€/>
<order_detail orderid=â€1011†productid=â€tool3†quantity=â€30â€/>
<order_detail orderid=â€1012†productid=â€tool4†quantity=â€12â€/>
<order_detail orderid=â€1012†productid=â€tool2†quantity=â€20â€/>
<order_detail orderid=â€1012†productid=â€tool5†quantity=â€30â€/>
</customer>

Could anyone help me out?
Thanks.
 
K

Kawarjit Bedi [MS]

The generated XML indicates that the relation between DataTable order and
order_detail is not nested. Set the Nested property on the corresponding
DataRelation to true. ( Note: The relation between Customer and order is
Nested)

Thanks,
Kawarjit Bedi

Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Similar Threads

Typed Dataset issue 1

Top