Delphi SQLite Update causing errors to appear.

Posted by NeoNMD on Stack Overflow See other posts from Stack Overflow or by NeoNMD
Published on 2010-04-27T21:32:18Z Indexed on 2010/04/27 21:43 UTC
Read the original article Hit count: 229

Filed under:
|

I have used Inserts, selects, updates, deleted without problem all over the program but for some reason this specific section causes it to except and not run the SQL I send it. I am trying to "UPDATE SectionTable(AreaID) VALUES ('+IntToStr(ActClient.AreaID)+') WHERE SectionID='+IntToStr(iCount)" The section with the ID "iCount" exists deffinately. The ActClient.AreaID is "2" and its overwriting null data in the "SectionTable" table.

What is the problem here?

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);

I get this error message appear when this is ran.

---------------------------
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   
---------------------------

© Stack Overflow or respective owner

Related posts about delphi

Related posts about sqlite