1

I have an update query which is returning an error, this is the code:

self.cur.execute("UPDATE Trainers SET Name=?, DOB=?, Gender=?",(Name, DOB, Gender))

This is the error:

sqlite3.OperationalError: near ",": syntax error
asked Feb 27, 2018 at 11:10
2

1 Answer 1

0

Try to use curly braces it will help you.

self.cur.execute("UPDATE Trainers SET Name={}, DOB={}, Gender={}",(Name, DOB, Gender))
answered Feb 27, 2018 at 11:15
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, that returns the error IndexError: tuple index out of rang
If are getting this issue. It should not throw any error. you can use alternative syntax as well. self.cur.execute("UPDATE Trainers SET Name=%s, DOB=%s, Gender=%s",(Name, DOB, Gender)) These might be the alternative solution

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.