[Tutor] problem with simple sqlite script

Alan Gauld alan.gauld at btinternet.com
Fri Nov 7 10:23:13 CET 2008

"aivars" <aivars868 at gmail.com> wrote

> sPath=r'e:\pythonexamples\aivars2.db'
> con=sqlite3.connect(sPath)
> cur=con.cursor()
> cur.execute("insert into test (name) values (?)",sPath)
> con.commit()

>  File "E:\PythonExamples\test.py", line 7, in <module>
>    cur.execute("insert into test (name) values (?)",sPath)
> ProgrammingError: Incorrect number of bindings supplied. The current
> statement uses 1, and there are 28 supplied.

It looks like name expects a char and you are giving it a string.
How did you define the name field of test?
Can you send us the create statement?

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list