我在整个程序中使用了插入,选择,更新,删除没有问题,但由于某种原因,这个特定的部分导致它除了并且不运行我发送它的SQL。 我试图“更新SectionTable(AreaID)VALUES('+ IntToStr(ActClient.AreaID)+')WHERE SectionID ='+ IntToStr(iCount)” 具有ID“iCount”的部分存在于deffinately。 ActClient.AreaID为“2”,并在“SectionTable”表中覆盖空数据。
这里有什么问题?
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);
运行此错误时会显示此错误消息。
---------------------------
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
---------------------------
答案 0 :(得分:1)
UPDATE table SET column = expression, column = expression WHERE predicates