2010-04-27 30 views
0

我已经使用插入,选择,更新,删除没有问题遍布整个程序,但由于某种原因,这个特定的部分导致它除了并不运行SQL我发送它。 我想“更新SectionTable(AreaID)VALUES('+ IntToStr(ActClient.AreaID)+')WHERE SectionID ='+ IntToStr(iCount)” 标识为“iCount”的部分存在。 ActClient.AreaID是“2”,它覆盖“SectionTable”表中的空数据。德尔福SQLite更新导致错误出现

这里有什么问题?

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

回答

1
UPDATE table SET column = expression, column = expression WHERE predicates