How do I update multiple tables from using TMyQuery?
Posted: Thu 23 Aug 2007 06:51
This strikes me as a really obvious question:
I have a query:
select a.keyfield,a.field1,a.field2,b.anotherfield
from firsttable a left join secondtable b on b.keyfield=a.keyfield
I wish to use a data control to edit the result (let us say, Datagrid)
The TMyQuery component behaves very well as far as updating the fields in firsttable, but does not update secondtable (fair enough).
What I want to on Posting is a) work out if anotherfield has been modified, and b) generate a sql to update secondtable if so.
Which event should I trap on? How would I tell the dataset that I've handled the update for it?
OnUpdateRecord would seem obvious, but it doesn't seem to actually trigger.
BeforeUpdateRecord?
I have a query:
select a.keyfield,a.field1,a.field2,b.anotherfield
from firsttable a left join secondtable b on b.keyfield=a.keyfield
I wish to use a data control to edit the result (let us say, Datagrid)
The TMyQuery component behaves very well as far as updating the fields in firsttable, but does not update secondtable (fair enough).
What I want to on Posting is a) work out if anotherfield has been modified, and b) generate a sql to update secondtable if so.
Which event should I trap on? How would I tell the dataset that I've handled the update for it?
OnUpdateRecord would seem obvious, but it doesn't seem to actually trigger.
BeforeUpdateRecord?