you assumed that the dataset will serialize the records based on some
relation between the tables - well, it doesn't. It serializes the
dataset one table after another (and will even support loading an XML in
which records from different tables are mixed, I suspect)
[quoted text, click to view] william wrote:
> 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.
>
>