RecIDValue is 0

Hello,

I’m trying to cancel changes that a user did.
But instead of doing a cancelupdates on the datatable, I want to make sure that I only cancel the current record.
So I built this code, which seams to work, but not always.
The first time I append a record, this code works, I get a RecIDValue and can use it to cancel the remove the change from the delta.
But if I directly after that append another record, the RecIDValue is always 0, so the removechange doesn’t work off course.

This is the code behind the cancel:

var
lRecNo: Integer;
lChange: TDADeltaChange;
begin
lRecNo := frm().MyDataSource.DataTable.RecIDValue;
lChange := frm().MyDataSource.DataTable.Delta.FindChange(lRecno);
frm().MyDataSource.DataTable.Delta.RemoveChange(lChange);

Can someone tell me what I’m doing wrong?

Thx
Dirk

Hi,

try to use

procedure TDADataTable.CancelUpdateChange(Change: TDADeltaChange;
                                          IncludeDetails : boolean = True);

Hello Evgeny,

Will that solve my problem?
The issue that I’m having is that DataTable.RecIDValue is returning 0.
So I wont be able to obtain a TDADeltachange.

Thx
Dirk

Hi,

you can review TDADataTable.CancelUpdateChange.
it does some extra actions, comparing with your code and this method is used in the reconcile dialog.