datarelation

  • Thread starter Thread starter Marco Martin
  • Start date Start date
M

Marco Martin

Hi Group,

I've got a datatable in a dataset. The Table has this schema; ID = id of
the record, RootID = id to which this record belongs to.

for example:

if I have 6 records, and rootID of records 1-5 is equal to 0, then the
parent of these records has the ID of 0;

I am trying to create a Relation between these two fields so when I bind
this data to a grid, it will display the hierarchy. I've been playing with
this for a while and cant get it right. Can somebody Please post a sample
on creating a simple relation inside the same datable.

Thanks in advance.

Marco
 
try the following, hope can help


DataRelation RootChildRel = dataset.Relations.Add("RootChild",
dataset.Tables["yourtable"].Columns["ID"],
dataset.Tables["yourtable"].Columns["RootID"]);

Pei
 
Back
Top