Код, используемый для удаления выбранного элемента:
def deletecase(self):
if not self.tree.selection():
ms.showerror('ERROR!!', 'INVALID SELECTION')
else:
result = ms.askquestion('CONFIRMATION!!', 'Are you sure you want to delete this record%s', icon="warning")
if result == 'yes':
curItem = self.tree.focus()
contents = (self.tree.item(curItem))
selecteditem = (contents['values'])
print(selecteditem)
self.tree.delete(curItem)
print(selecteditem[1])
sql = "DELETE FROM Cases WHERE caseid = %s"
adr = str(selecteditem[1])
c.execute(sql, adr)
Это сообщение об ошибке:
Exception in Tkinter callback
[32, 'Big Case', 0, 'water', 320, 350, 50, 0]
Big Case
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%s' at line 1
Процесс завершен с кодом выхода 0