Is it possible : fill the SQLUpdate property with 2 Statements

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Is it possible : fill the SQLUpdate property with 2 Statements

Post by swierzbicki » Thu 18 Aug 2005 08:06

Hi,

I have a master (with an autoinc field) query.
A detail query is linked to the master query.

After inserting and posting a master record, I want to automatically insert a record into the detail table.

I first choose the OnBeforePost event of the master table. But this isn't a good solution : it is triggered after dsedit / dsinsert state.

Then,on the master query, I launch the mysqlEditor and I've generated the SQL statements. In the SQL Insert statement, I've added a second statement that will fill the detail table given the master query autoinc field.

Insert went fine, but the second statement wans't executed.
Is there any workarround ?

Thank you

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 22 Aug 2005 11:46

Try to use AfterPost event

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Mon 22 Aug 2005 12:36

Ok, AfterPost seems the easiest solution, but how to know if the "afterpost event" cames is fired by an insert/append or an edit event ?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 22 Aug 2005 13:29

Try to set any flag on BeforeInsert and discard it on BeforeEdit.

Post Reply