Delphi 10 with Firemonkey and SQLite: after running the code below, I want to get the identifier of the last record inserted into the SQLite table. How to get the last identifier?
NOTE. The table ID field 1 is auto-incrementing.
var myQr: TFDQuery; begin myQr := TFDQuery.Create(Self); with myQr do begin SQL.Add('Insert into table1 values (:_id, :_name, :_dthr)'); Params.ParamByName('_id').ParamType := TParamType.ptInput; Params.ParamByName('_id').DataType := TFieldType.ftInteger; Params.ParamByName('_id').Value := null; ParamByName('_name').AsString := 'name test'; ParamByName('_dthr').AsDateTime := Now; ExecSQL; end;
source share