First I tried:
sqlite3.cursor.execute("select * from mytable where mycol=?", (myval,))
when I execute it in the shell it works. In my class method it tells me: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 12 supplied.
Then I tried:
sqlite3.cursor.execute("select * from mytable where mycol='%s'" % myval)
when I execute it in the shell it works. In my class method it tells me: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 12 supplied.
So I decided to just format the string first and then pass that in. Like this:
sqlcmd = "select * from mytable where mycol='%s'" % myval
when I execute it in the shell it works. In my class method it tells me the same error: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 12 supplied.
My method is defined like this:
def mymethod(self, myval):
cur = self.conn.cursor()
cur.execute( "..." ... )
....
What am I missing?