TSqlite3Dataset Insert/Append and Edit lazarus / 16-Databases ---------------------------------------------------------------------- nightrider · 2013-04-16 23:11 I'm confused. I have a project where I have TSqlite3Dataset. I would like to Insert a new record. First I open the dataset with the following SQL statement; cdsAux.SQL := 'select * from tabempresa limit 1'; cdsAux.Open; Next I do: cdsAux.Insert; cdsAux.FieldByName('col1').AsInteger := 5; cdsAux.FieldByName('col2').AsString := 'field number 5'; try   cdsAux.Post; except   on e:Exception do           ShowMessage(e.Message); end; When the code piece was executed, no exception occurs but nothing was insert in the SQL table. I try do add a cdsAux.ApplyUpdates; Nothing happens again. I do the insert via cdsAux.ExecuteDirect('insert into tabempresa values(5,'field number 5')); BTW with ExecuteDirect the record was inserted. Where am I making a mistake, please? Greetings from São Paulo - Brasil Ricardo ---------------------------------------------------------------------- LuizAmérico · 2013-04-16 23:17 http://sqlite4fpc.yolasite.com/faq.php Q06 ---------------------------------------------------------------------- nightrider · 2013-04-17 12:33 I'm afraid that I didn't understand your intention, Luiz. The SELECT that I put in my example was only to Open the query. For use Insert, Append or Edit the query must be open. May you explain a little bit more please? Cheers Ricardo ---------------------------------------------------------------------- Leledumbo · 2013-04-17 16:31 Maybe you could post the SQL to create the table, ensuring a primary key or an autoinc field exists there. ---------------------------------------------------------------------- nightrider · 2013-04-17 16:46 CREATE TABLE tabempresa (CDEMP   smallint not null, -- empresa  DSNOMECOM varchar(40) not null,  constraint tabempresa_PK primary key (CDEMP)); The table was empty and the code suggested in the first post of this thread doesn't add data to the table and no exception occured in the POST command, which is in try-except. Cheers