z.B. so
Delphi-Quellcode:
OleDbConnection1.Open;
OleDbCommand1.CommandText := 'SELECT * FROM Table_2';
parent.SelectCommand := OleDbCommand1;
OleDbCommand2.CommandText := 'SELECT * FROM table1';
child.SelectCommand:= OleDbCommand2;
parent.Fill(DataSet1,'master');
child.Fill(dataset1,'child');
pkparent := dataset1.Tables['master'].Columns['tab1_id'];
fkchild := dataset1.Tables['child'].Columns['id'];
therelation := DataRelation.Create('rel', pkparent, fkchild, false);
DataSet1.Relations.Add(therelation);
parent und child sind OLEDBDataadapter