[Tutor] problem with simple sqlite script

aivars aivars868 at gmail.com
Fri Nov 7 11:26:27 CET 2008


Thanks, Alan,
here is a create statement:

CREATE TABLE "test" ("name" TEXT)

And also I would like to thank you for you web page. Classes and OOP
seems to start to make sense to me now slowly after I am reading your
material.


Aivars


2008/11/7 Alan Gauld <alan.gauld at btinternet.com>:
>
> "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
> http://www.freenetpages.co.uk/hp/alan.gauld
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list