Recent

Author Topic: TDBNavigator and delete  (Read 4892 times)

Fabio

  • New Member
  • *
  • Posts: 13
TDBNavigator and delete
« on: April 14, 2012, 04:29:08 pm »
Hi all, I've searched in the forum and with Google with no result.

I'm new on Lazarus and I'm trying to use SQLite with TSQLQuery/TDBGrid/TDBNavigator.

I've problem when I try to delete a record with the button "minus" of navigator.
The record in grid is deleted but when I call the ApplyUpdates I get the error: "no delete query specified and failed to generate one".

How can I delete a record?
I must use the AfterDelete event of navigator?

Thanks (sorry for my poor english).

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: TDBNavigator and delete
« Reply #1 on: April 16, 2012, 11:39:35 am »
Here's an example that reproduces the error. If anyone would know how to fix a favor to me! thanks


http://www.lazaruspascal.it/esempi/Sqlite.zip
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: TDBNavigator and delete
« Reply #2 on: April 16, 2012, 12:19:29 pm »
SQlQuery1 has Upda]"]>Blockedde set to upWhereKeyOnly but you do a 'select Nome FROM T_Prova;' which does not contain a key. Change SQL to 'select * FROM T_Prova;' or change Upda]"]>Blockedde to upWhereChanged or upWhereAll.

Fabio

  • New Member
  • *
  • Posts: 13
Re: TDBNavigator and delete
« Reply #3 on: April 16, 2012, 01:45:43 pm »
Good, I've changed my SQL from "SELECT ... FROM ..." to "SELECT * FROM ..." and deletion done.

Thanks.

 

TinyPortal © 2005-2018