L
L
lavagod2019-11-10 16:50:41
Python
lavagod, 2019-11-10 16:50:41

How to delete record with ID=xx in SQLite3?

Good afternoon
I am writing a simple, primitive database for 4 fields in SQLite under Python. Everything works))) Everything is added, removed, edited. I am writing using tkinter, on the field there is a text field for the database text (Text), a text field t1 (Entry) and a button b1 (Button) with an attached function for deleting an entry c ID = t1.get()
The essence of the problem: records c are deleted from the database ID=0-9, even if these entries are made just on the fly in the program, but as soon as the identifier becomes two-digit, the deletion does not occur, an error is generated.
ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied.
Programming Error: Wrong number of bindings provided. The current statement uses 1, but there is 2.
Here is the code for the delete function and where it is called:

def db_del_record():
  dbase.execute(''' 
    DELETE FROM users 
    WHERE ID=? 
    ''', (t1.get()))
  dbase.commit()
  db_write()

# Удалить (1)
l1 = Label(text="Удалить запись (ID)").pack()
t1 = Entry()		# ID
t1.pack()
b1 = Button(text="Удалить",command=db_del_record).pack()

What are the 2 bindings?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question