N
N
Neiro House2020-04-16 14:55:30
Python
Neiro House, 2020-04-16 14:55:30

How to do proper deletion of rows in sqlite3?

my code is the following:

#array_set[0] - выдаёт нужный ID (берёт из tk.treeview) - работает как часы
        self.c.execute("""DELETE FROM table WHERE id = ?; """,array_set[0])
        self.tree.delete(self.tree.selection())
        self.conn.commit()
        self.conn.close()

The problem is that they are deleted only if ID < 10. then if the ID, for example, is two-digit, then it produces a trace. error :

self.c.execute("""DELETE FROM stabilometr WHERE id = ?; """,array_set[0])
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied.

what's the bug? how to fix ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay, 2020-04-16
@GlueStack

Look at the output array_set[0], writes that there are two parameters, instead of one that is used in the command.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question