Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2022-06

Differentiate between insert and append in TDataset events

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,

using a TDbGrid, I want to take different actions if the user is inserting or appending a record (in this case to automatically assign the ordering field so that the record appears in the right row after post).

The method TDataSet.DoInsertAppend just differentiates them internally, there is no flag/parameter to indicate it to the events (i.e. BeforeInsert, OnNewRecord, AfterInsert), I suppose because delphi does it that wey.

Now, since I'm using zeos, I see that if it's inserting, the RecNo in AfterInsert is the same as it was in BeforeInsert, while they are different during an append.

I suppose that depends on the TDataset and database used, so it may not hold true if I switch to a different dataset or database.

Is there a better, proper, way to discriminate between the two cases?

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email