Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Why is onBeforepost executed directly
Thu, Nov 19 2020 5:56 PMPermanent Link

Peter van Mierlo

EVENTSOFT

Avatar

Hi

After a long time I have to run a dbisam project where I run into something strange that I don't have with mySQL.

An OnActivate of my form checks whether the database is active. If not, it will be set to active = true

There is also an OnBeforePost that checks whether a field has been filled in and reports when this is not the case.

As soon as the form is opened and the database is set to active, the OnBeforePost will be executed. There are no triggers that execute a post or a calculated field anywhere.

Why is this behavior and how can I avoid it so that I can run my OnBeforePost for what it's intended.

Regards Peter
Thu, Nov 19 2020 6:58 PMPermanent Link

Peter van Mierlo

EVENTSOFT

Avatar

Hi

I have now removed all 'on' event code from the TDBISAMTable and code in the form.
Using DBsys the table is cleared and contains 0/0 records.

Application started, form opened and closed again.

Now checked with DBsys and there is 1/1 records and the autoinc. field contains a record number.
This while nowhere a record is created by code.

Is this behavior of TDBISAMtable or what causes it?
Thu, Nov 19 2020 9:16 PMPermanent Link

Raul

Team Elevate Team Elevate

On 11/19/2020 6:58 PM, Peter van Mierlo wrote:
> I have now removed all 'on' event code from the TDBISAMTable and code in the form.
> Using DBsys the table is cleared and contains 0/0 records.
>
> Application started, form opened and closed again.
>
> Now checked with DBsys and there is 1/1 records and the autoinc. field contains a record number.
> This while nowhere a record is created by code.
>
> Is this behavior of TDBISAMtable or what causes it?

No - not DBISAM behaviour.

Something in your app still.

Are you using design time components, linked to data controls by any
chance or maybe running a sql script or something similar ?

Raul




Fri, Nov 20 2020 3:14 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Peter


I have to agree with Raul on this. Even though its a while since I used DBISAM in anger I just can't see opening the table causing an insert and post.

I would also suggest dumping the check for active just use table.open - it will check if its active or not. I'd also suggest just open the tables when the form is created, and unless you close it that will be it (might need a refresh now and again if you update using another table instance).

Roy Lambert
Fri, Nov 20 2020 8:08 AMPermanent Link

Peter van Mierlo

EVENTSOFT

Avatar

Hi Roy/Raul

Thanks for the feedback.

After a few hours of trying and excluding things, I find out what the problem is.
I am using components from Almediadev and the problem is caused by a dbcheckbox.

Fortunately, it is reproducible.

- when I remove the data source everything goes fine.
- when i reconnect the data source, it goes wrong.
- when i use a STANDARD dbcheckbox then it will also work.

Issue has been reported to Almediadev

Thanks again
Fri, Nov 20 2020 9:44 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Peter


Try adding an empty procedure to the OnClick event handler. You'll need to add a comment line into the procedure to stop Delphi removing it.

Roy Lambert
Image