Problem with sqlite bindings - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem with sqlite bindings (/thread-26905.html) |
Problem with sqlite bindings - scratchmyhead - May-18-2020 I'm trying to update a sqlite database and I get the following error: sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 4 supplied. I don't understand where I'm going wrong. The code is below: conn = sqlite3.connect('financial.db') c = conn.cursor() c.execute("SELECT * FROM totals") records = c.fetchall() for record in records: if record[0] ==arrivale.get(): t = ratee.get() c.execute("UPDATE totals SET rent = ? ", (t)) c.fetchall() RE: Problem with sqlite bindings - Larz60+ - May-18-2020 do you mean: if record[0] == "arrivale.get()":
RE: Problem with sqlite bindings - scratchmyhead - May-18-2020 No. It shouldn't have "" RE: Problem with sqlite bindings - Larz60+ - May-18-2020 if that's not part or the html, then where's the code for arrivale.get()? Not showing enough code RE: Problem with sqlite bindings - scratchmyhead - May-18-2020 I figured it out. The code should have a ',' after the t like the follwoing: c.execute("UPDATE totals SET rent = ? ", (t,)) |