Topic: ID in new record without to use counter
Can someone help me? The code below doesn't work, because when the record is deleted, sqlite ignores ID that has already been deleted. For example: ID 200 deleted. The statement "sqlexecute('select max(id) from people') + 1" will generate an ID 200, but sqlite will provide ID 201. Is there any routine that informs which new ID will be provided by sqlite?
procedure form2_OnShow (Sender: string; Action: string);
begin
if action <> 'NewRecord' then form2.edit1.Value:= sqlexecute('select id from people where id =' +inttostr(form1.tablegrid1.dbitemid));
if action = 'NewRecord' then form2.edit1.value:= sqlexecute('select max(id) from people') + 1;
end;