ApplyUpdate : SQL Error: SQL logic error or missing database
Posted: 26.04.2016, 19:05
Hi,
I ve got the code below to update a SQLite-3 database :
But it display the error message when I call ApplyUpdates :
TApplication.HandleException SQL Error: SQL logic error or missing database The problem come from the use of an update object TZUpdate... If I delete the reference of this object then I can ApplyUpdate but I have to look this afternoon if it is working as it does...
My database is a sqlite file, and I'm the owner of the file and the executable of my application. So it looks like an other problem than access file. The SQLEditSeance dataset is alone, simple, not in Master / Detail or other complicated schema.
SQLEditSeance parameters :
CachedUpdate = true
FechRow = 0 (tested also with 1, there is only one row in my dataset, the goal is to edit one row...)
SQL :
UpdateMode = umUpdateChanged
Wheremode = wmWhereKeyOnly
Update object
ModifySQL:
Do I need to add 'WHERE pkseance = :pkseance' clause in the updateSQL ?
refreshSQL
Do you have some idea I could test ?
Thank you for your help.
I'm using LAzarus 1.4.4 with Free PAscal 3.0 and Zeoslib 7.2 (svn from last week)
I ve got the code below to update a SQLite-3 database :
Code: Select all
procedure TFormMain.EnregistrerClick(Sender: TObject);
begin
try
//Update enreg
DataModule1.SQLEditSeance.ApplyUpdates;
DataModule1.ZConnection2.Commit;
except
On E: EDatabaseError do
begin
MessageDlg('Erreur',
'EnregistrerClick::Erreur de base de donnée : ' + E.Message,
mtError, [mbOK],0);
end;
end;
end;
TApplication.HandleException SQL Error: SQL logic error or missing database The problem come from the use of an update object TZUpdate... If I delete the reference of this object then I can ApplyUpdate but I have to look this afternoon if it is working as it does...
My database is a sqlite file, and I'm the owner of the file and the executable of my application. So it looks like an other problem than access file. The SQLEditSeance dataset is alone, simple, not in Master / Detail or other complicated schema.
SQLEditSeance parameters :
CachedUpdate = true
FechRow = 0 (tested also with 1, there is only one row in my dataset, the goal is to edit one row...)
SQL :
Code: Select all
SELECT PEDAGOLesSeances.*
FROM PEDAGOLesSeances
WHERE PEDAGOLesSeances.PKseance = :PKseance
Wheremode = wmWhereKeyOnly
Update object
ModifySQL:
Code: Select all
UPDATE `PEDAGOLesSeances` SET
`nomseance` =:nomseance,
`maxeleves`= :maxeleves,
`groupe` = :groupe,
`partenariat` = :partenariat,
`outils` = :outils,
`ressources` = :ressources,
`deroulement` = :deroulement,
`cote` = :cote,
`productions` = :productions,
`evaluation` = :evaluation,
`FKmodele` = :FKmodele,
`FKsequence` = :FKsequence,
`FKetat` = :FKetat,
`ordresequence` = :ordresequence,
`resteafaire` = :resteafaire,
`niveaux` = :niveaux,
`objectifsdocumentaire` = :objectifsdocumentaire,
`objectifsdisciplinaire` = objectifsdisciplinaire,
`prerequisdocumentaire` = :prerequisdocumentaire,
`prerequisdisciplinaire` = :prerequisdisciplinaire,
WHERE pkseance = :pkseance
refreshSQL
Code: Select all
SELECT PEDAGOLesSeances.*
FROM PEDAGOLesSeances
WHERE PEDAGOLesSeances.PKseance = :PKseance
Thank you for your help.
I'm using LAzarus 1.4.4 with Free PAscal 3.0 and Zeoslib 7.2 (svn from last week)