I am currently working on a coursework project for school and it is a database system with a user interface using Tkinter, Python and SQLite3. I have made a form to add, delete, update and search for customers. The update function is not producing any errors, however, the changes are not being made to the .db file. Could anyone please have a look and maybe tell me where I have went wrong? I will attach photos of the user interface and the code for the function. I'm not used to using StackOverflow, so please let me know if I have left anything out or if you need more information. Thank you in advance.
def UpdateCustomer(self):
customerid = self.CustomerEntry.get();
town = self.TownEntry.get();
postcode = self.PostcodeEntry.get();
with sqlite3.connect("LeeOpt.db") as db:
cursor = db.cursor()
update_customer = ('''UPDATE Customer
SET
Town = ?,
Postcode = ?
WHERE CustomerID = ?
''')
db.commit()
cursor.execute(update_customer,[(customerid),(town),(postcode)])
tkinter.messagebox.showinfo("Notification","Customer record updated successfully")
self.ClearEntries()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…