简体   繁体   中英

SQlite UPDATE WHERE Syntax Error

I have this code with 2 entry boxes in tkinter which are passed through a database. 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. This is the code

        cursor.execute('''

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


    ''')

The error is sqlite3.OperationalError: near "(": syntax error

The set clause shouldn't be surrounded with parenthesis, just remove them and you should be OK:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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