G
Guest
I have DataSet with two tables constructed as following:
1. the DataSet is initially filled by DataAdapter .
2. a new DataTable is created and filled with data returned by a stored
procedure
3. the new DataTable is added to DataSet using DataSet.Table.Add() method
4. Then we build the relation with two DataTables inside DataSet As following:
DataRelation oLORelation =
ds.Relations.Add("MyRelation",ds.Tables[0].Columns["ID"],ds.Tables["OutcomesDT"].Columns["ID"],false);
oLORelation.Nested = true;
the xml produced after do WriteXml in DataSet as following (Sample one)
<Root>
<Table>
<ID>1</ID>
<Name>Jim</Name>
<Age>12</Age>
<OutcomesDT>
<ID>1</ID>
<Married>false</Married>
</ OutcomesDT>
</Table>
<Table>
<ID>2</ID>
<Name>Jim</Name>
<Age>32</Age>
<OutcomesDT>
<ID>2</ID>
<Married>true</Married>
</ OutcomesDT>
</Table>
</Root>
I have the problem with the following when I read the XML generated after do
the above operation how Can I deal with Parent-Child Data (means I get the
record with ID 2 and need to update its relative childs using DataSet)
1. the DataSet is initially filled by DataAdapter .
2. a new DataTable is created and filled with data returned by a stored
procedure
3. the new DataTable is added to DataSet using DataSet.Table.Add() method
4. Then we build the relation with two DataTables inside DataSet As following:
DataRelation oLORelation =
ds.Relations.Add("MyRelation",ds.Tables[0].Columns["ID"],ds.Tables["OutcomesDT"].Columns["ID"],false);
oLORelation.Nested = true;
the xml produced after do WriteXml in DataSet as following (Sample one)
<Root>
<Table>
<ID>1</ID>
<Name>Jim</Name>
<Age>12</Age>
<OutcomesDT>
<ID>1</ID>
<Married>false</Married>
</ OutcomesDT>
</Table>
<Table>
<ID>2</ID>
<Name>Jim</Name>
<Age>32</Age>
<OutcomesDT>
<ID>2</ID>
<Married>true</Married>
</ OutcomesDT>
</Table>
</Root>
I have the problem with the following when I read the XML generated after do
the above operation how Can I deal with Parent-Child Data (means I get the
record with ID 2 and need to update its relative childs using DataSet)