S
S
SeRvErKrAuCh2015-05-30 21:28:59
Delphi
SeRvErKrAuCh, 2015-05-30 21:28:59

How to link tables in ADOQuery in Delphi?

There is no Mastersource property in ADOQuery, how to link three tables? One of them is the main table with the key field Key, and the other two tables are subordinate. Each of these tables has a key field Product.
The action should be like this: for example, the user clicks on a record in table 1, and the data of this record is displayed in table 2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iloer, 2015-05-30
@iloer

For the master table, handle the AfterScroll event, something like this:
Master query
Detail query

procedure TForm1.ADOQuery1AfterScroll(DataSet: TDataSet);
begin
  ADOQuery2.Close;
  ADOQuery2.Parameters[0].Value := ADOQuery1.FieldByName('id').Value;
  ADOQuery2.Open;
end;

Try something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question