TSQLQuery before post method question lazarus / 16-Databases ---------------------------------------------------------------------- gambothell · 2009-02-18 18:04 I am using v0.9.24 of Lazarus and Ubuntu 8.10 and MySQL5.0 In my database application I am testing for a duplicate record when inserting a new record into MySQL in the BeforePost method of the TSQLQuery component. If I see a duplicate record I print an error message then issue a SQLQuery1.Cancel which takes the dataset out of dsInsert. I then exit the BeforePost without updating MySQL. What is weird is that the AfterPost method gets executed and then the BeforePost and AfterPost methods fire up again. The user sees the duplicate error message twice. After that, everything is OK. The DBGrid shows the records properly and the MySQL database is correct. Since the dataset is no longer in dsInsert mode, I do not understand why the BeforePost method fires up the second time. Any suggestions? ---------------------------------------------------------------------- gambothell · 2009-02-18 19:32 The TSQLQuery BeforePost works properly. I found my problem. I screwed up a filter statement. Sorry that I did not catch it first.