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