I ran the simple code showed below and nothing happens with the table "tblpar" in the database associated with SQLite3Dataset named "cdsTeste".
If I transform the code from cdsTeste.Insert thru ShowMessage in comments and remove the comment in the cdsTeste.ExecuteDirect, the database is updated successfully and a new row appears in it.
Can someone of you explain what's happen here, please? I'm using Lazarus 0.9.30 with SQLite 3 in windows 7. But I pretend to execute the application in windows mobile as soon as I solve this problem.
Code mentioned above:
procedure TForm1.Button1Click(Sender: TObject);
begin
cdsTeste.SQL := 'select * from tblpar where cdemp = -69';
try
cdsTeste.Open;
except
On e:Exception do
begin;
ShowMessage('Erro open = '+ e.Message);
Halt;
end;
end;
if cdsTeste.RecordCount > 0 then
begin;
ShowMessage('Record count inesperado = ' + IntToStr(cdsTeste.RecordCount));
Halt;
end;
cdsTeste.Insert;
cdsTeste.FieldByName('cdemp').AsInteger := 6969;
cdsTeste.FieldByName('dsnomecom').AsString := 'fhasjfhsjfhksfhsjkfsdjkfns dfa';
cdsTeste.FieldByname('dspath').Clear;
cdsTeste.Post;
ShowMessage(BoolToStr(cdsTeste.ApplyUpdates));
// cdsTeste.ExecuteDirect('insert into tblpar(cdemp,dsnomecom,dspath) values(6969,''fhasjfhsjfhksfhsjkfsdjkfns dfa'',null)');
end;
Greetings from Sao Paulo - Brasil
Ricardo