Jun-21-2021, 08:05 AM
(This post was last modified: Jun-21-2021, 08:05 AM by ibreeden.
Edit Reason: extra info
)
Hi Maryan,
There are some things I do not understand. I believe your program or database table have changed since 2021-06-09.
And there is no column "NAME"? But then the query at line 8 ("SELECT room,name,surname FROM Guest WHERE room = {}") must also have failed.
And by the way. Using the old "format()" method is not the best way. Please study how to use bind variables in sqlite3. Like this.
There are some things I do not understand. I believe your program or database table have changed since 2021-06-09.
(Jun-20-2021, 03:26 PM)Maryan Wrote:This is weird. You never mentioned the column "forSurname" before.
Error:No such column: NAME; or No such column: forSurname
And there is no column "NAME"? But then the query at line 8 ("SELECT room,name,surname FROM Guest WHERE room = {}") must also have failed.
(Jun-20-2021, 03:26 PM)Maryan Wrote:But these ar not the update statements from your program! You had:
Error:cur.execute("UPDATE Guest SET name = {} WHERE room = roomNumber".format(newName)) cur.execute("UPDATE Guest SET surname = {} WHERE room = roomNumber".format(newSurname))
cur.execute("UPDATE Guest(name) SET name = {} WHERE room = {}").format(newName,roomNumber)So please show us the actual state:
- give a description of the "Guest" table,
- Create the smallest program to reproduce the error and show this,
- Also show the complete error in the applicable tags.
And by the way. Using the old "format()" method is not the best way. Please study how to use bind variables in sqlite3. Like this.
cur.execute("UPDATE Guest(name) SET name = ? WHERE room = ?", (newName, roomNumber) )Note: the second parameter must be a tuple. You should use this principle for reasons of security and performance.