Home All Groups Group Topic Archive Search About

Repost: Relationship creation using DataSet Schema and XML Output

Author
3 Oct 2005 1:14 AM
Joey Lee
Hi,

Sorry for reposting it in another newsgroup. I was wondering if anyone
encounter this before and able to help me. Thanks


I have created a dataset schema(*.xsd) which contain two element
"InvoiceHeader" and "InvoiceDetail".

I set the primary key of both the element. for example "InvoiceHeader" -> id
and "InvoiceDetail" -> "id, date"

Then I created a relationship between both these item using the key "id".
This create the one-to-many relationship.

I set the relationship object for "IsNested" to true.

Now I fill up both the "InvoiceHeader" and "InvoiceDetail" from the database

When I execute the command WriteXML(). The output xml does not have the
correct nested relationship that i defined in the dataset schema. I need to
insert the following code to ensure the output is correct

--------------------------------------------------------------------

DataRelation paRel = xmlOut.Relations.Add("paRel",new DataColumn[] {
xmlOut.InvoiceHeader.Columns["id"] }, new DataColumn[] {
xmlOut.InvoiceDetail.Columns["id"] });
paRel.Nested = true;

---------------------------------------------------------------------

So based on this i am assuming that the relationship created in the dataset
schema is not working or used?. How do i enable it to do the correct nesting
and relationship without the above code?. Thanks

Joey

AddThis Social Bookmark Button