Hello,
I'm filling a table with a handled device. Sometimes my users are doing mistakes and want to delete the record.
My issue is that ID value is always set to 0. The only solution I have is to refresh the table to get the record with the correct Id.
This is really combersome as my table has hundreds of records.
What can I do to get from the start my record Id ? There is no refreshRecord function or methods available.... (I'm worjing with TSQLQuery et TSQLIteConnection) :
if not SQliteTransaction.Active then
SQliteTransaction.StartTransaction;
try
qrStockEntree.Insert;
qrStockEntree.fieldbyname('Date').Value := now;
qrStockEntree.Post;
qrStockEntree.ApplyUpdates;
if SQliteTransaction.Active then
SQliteTransaction.CommitRetaining;
Showmessage(inttostr(qrStockEntree.fieldbyname('ID).AsInteger)); // ===> ALWAYS RETURN 0 (ID IS AUTOINC FIELD)
except
on e: exception do
begin
if SQliteTransaction.Active then
SQliteTransaction.RollbackRetaining;
MessageDlg ('Erreur',e.message, mtError,
[mbOk],0) ;
exit;
end;
Thank you