我试图在具有模块化输入的python脚本中创建准备好的SQL语句。我有" INSERT"该语句的一部分工作但无法使模块化更新WHERE子句。有没有办法做到这一点?
query = "INSERT INTO MachineInfo ( Description, Location, IP, License )
WHERE id = ID
VALUES (?,?,?,?,?)"
#The arguments are all predefined variables
args = [ deviceName, deviceLocation, ipAddress, license, ID ]
system.db.runPrepUpdate( query, args )
答案 0 :(得分:1)
您似乎想要UPDATE
:
UPDATE MachineInfo
SET Description = ?,
Location = ?,
IP = ?,
License = ?
WHERE id = ?;