TUniQuery and LiveBinding - SQLite Dataset does not refresh after post
Posted: Wed 15 Oct 2014 06:39
Hi,
I used to be able (before XE7?) to do this with SQLite :
Instead of calling "select last_insert_rowid() id" I used to do get the new value for my primary key from FieldByName('ID').AsInteger after the POST. However it does not work anymore!!??
SQLite :
Please advise.
Thanks
Christoph
I used to be able (before XE7?) to do this with SQLite :
Code: Select all
procedure SaveData(var aDataRec : TDataRec);
var q : TUniQuery;
begin
q := TUniQuery.Create(Self);
try
with q do begin
Connection:=UniConnection1;
SQL.Text:=Format('select * from myTable where ID=%d',[aDataRec.ID]);
open;
if RecordCount=0
then append
else edit;
// ID is auto incremented
FieldByName('myData').AsString := aDataRec.MyData;
post;
aDataRec.ID := FieldByName('ID').AsInteger;
end; // with q
finally
q.Free;
end;
SQLite :
Code: Select all
CREATE TABLE `MyTable` (
`ID` INTEGER PRIMARY KEY AUTOINCREMENT,
`myData` varchar(35)
);
Thanks
Christoph