Python Forum
Problem with sqlite bindings
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with sqlite bindings
#1
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()
Reply
#2
do you mean:
if record[0] == "arrivale.get()":
Reply
#3
No. It shouldn't have ""
Reply
#4
if that's not part or the html, then where's the code for arrivale.get()?
Not showing enough code
Reply
#5
I figured it out. The code should have a ',' after the t like the follwoing:

c.execute("UPDATE totals SET rent = ? ", (t,))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with inserting a string in to Sqlite db darktitan 3 4,437 Mar-03-2019, 06:30 PM
Last Post: stranac

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020