Author Topic: [Solved] SQLite3 - Delete a row with a SQLQuery in a DBGrid  (Read 373 times)


  • New Member
  • *
  • Posts: 38
[Solved] SQLite3 - Delete a row with a SQLQuery in a DBGrid
« on: November 24, 2020, 07:04:03 pm »
I create an example to insert, edit and delete data in a table under SQLite3.
The insertion works.
I am trying to delete a row of data from the table from part of the row from the DBGrid with an SQLQuery.
I have a problem with the procedure.
Despite the error, if I force the source to continue, the selected row is deleted.
The error tells me that the dataset is only read-only.
I have checked all the readonly properties of the components and the grid, they are indeed false.
I don't see where the problem could be other than in the component properties.
Thank you for your help and I have attached my source to you
« Last Edit: November 27, 2020, 06:01:32 pm by folkeu08 »


  • New Member
  • *
  • Posts: 42
Re: SQLite3 - Delete a row with a SQLQuery in a DBGrid
« Reply #1 on: November 25, 2020, 07:58:54 pm »
myExamplePackage is missing from your files, so I can't run your program.  That said, all of your code and components looks to be in order.  I saw nothing set to Read Only.

Your Query gets executed and deletes the record from your database:
Code: Pascal  [Select][+][-]
  1. Cellule_SQLQuery.SQL.Text := 'delete from Cellule where id_cellule = '+ quotedStr(IntToStr(str))+';' ;
  2. Cellule_SQLQuery.ExecSQL;

and then you make this call:
Code: Pascal  [Select][+][-]
  1. Cellule_SQLQuery.Delete;

That might be your problem.
« Last Edit: November 25, 2020, 09:04:12 pm by Slyde »
Linux Mint 20.0 / Lazarus 2.0.10 / FPC 3.2.0
Windows X / Lazarus 2.0.10 / FPC 3.2.0


TinyPortal © 2005-2018