J'ai utilisé Inserts, sélectionne, met à jour, supprime sans problème tout le programme mais pour une raison quelconque, cette section spécifique l'oblige à exécuter le SQL que je lui envoie. J'essaye de "UPDATE SectionTable (AreaID) VALUES ('+ IntToStr (ActClient.AreaID) +') WHERE SectionID = '+ IntToStr (iCount)" La section avec l'ID "iCount" existe deffinately. L'ActClient.AreaID est "2" et ses données nulles d'écrasement dans la table "SectionTable".Delphi SQLite Mise à jour provoquant l'apparition d'erreurs
Quel est le problème ici?
OpenDatabase(slDb);
sltb:=sldb.GetTable('SELECT * FROM SectionTable WHERE SectionID='+IntToStr(iCount));
OutputDebugString(PAnsiChar(sltb.FieldAsString(sltb.FieldIndex['SectionID'])+sltb.FieldAsString(sltb.FieldIndex['Gender'])+sltb.FieldAsString(sltb.FieldIndex['CompetitionID'])));
sSQL := 'UPDATE SectionTable(AreaID) VALUES ('+IntToStr(ActClient.AreaID)+') WHERE SectionID='+IntToStr(iCount);
sldb.ExecSQL(sSQL);
CloseDatabase(slDb);
Je reçois ce message d'erreur quand il est exécuté.
---------------------------
Debugger Exception Notification
---------------------------
Project CompetitionServer.exe raised exception class ESQLiteException with message 'Error executing SQL.
Error [1]: SQL error or missing database.
"UPDATE SectionTable(AreaID) VALUES (2) WHERE SectionID=2": near "(": syntax error'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------