tags:

views:

99

answers:

1

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   
---------------------------
+1  A: 
UPDATE table SET column = expression, column = expression WHERE predicates
Marcus Adams