DataSet Tables Relation

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)
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top