简体   繁体   English

SQlite UPDATE WHERE语法错误

[英]SQlite UPDATE WHERE Syntax Error

I have this code with 2 entry boxes in tkinter which are passed through a database. 我在tkinter中有2个输入框的代码,这些输入框通过数据库传递。 I am trying to create and update query which updates the record in the database however I do not know how to create this from entry boxes. 我正在尝试创建和更新查询,以更新数据库中的记录,但是我不知道如何从输入框中创建该记录。 I have already researched this error. 我已经研究了这个错误。 Exercise and Weight are the two entry boxes with MemberID being used to identify which record to update. 锻炼和体重是两个输入框,其中的MemberID用于标识要更新的记录。 This is the code 这是代码

        cursor.execute('''

        UPDATE Exercises
        SET (Exercise =?, Weight = ?)
        WHERE MemberID=? ;


    ''')

The error is sqlite3.OperationalError: near "(": syntax error 错误为sqlite3.OperationalError: near "(": syntax error

The set clause shouldn't be surrounded with parenthesis, just remove them and you should be OK: set子句不应用括号括起来,只需将其删除即可,您应该可以:

UPDATE Exercises
SET    Exercise = ?, Weight = ?
WHERE  MemberID = ?;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM