sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 6, and there are 5 supplied -


this question has answer here:

i not understand doing wrong. table is:

conn.execute('''create table users        (email           text    not null,        password         text    not null,        first_name       text    not null,        last_name        text    not null,        date             text    not null,        sex              text    not null);''') 

and when trying insert table:

conn.executemany("insert users values (?, ?, ?, ?, ?, ?)", [email, password, first_name, last_name, date, sex]) 

i error:

sqlite3.programmingerror: incorrect number of bindings supplied. current statement uses 6, , there 5 supplied. 

if add question error same now:

sqlite3.operationalerror: table users has 6 columns 7 values supplied 

if add comma without question mark error different:

sqlite3.operationalerror: near ")": syntax error 

the variables value are:

    email=str(myapp.register_email.text())     print email     first_name=str(myapp.first_name.text())     print first_name     last_name=str(myapp.last_name.text())     print last_name     date=str(myapp.date.text())     print date     password="nht"     print password     sex=str(myapp.sex.currenttext())     print sex 

i getting insane here cant figure out problem

as suggested python doc, executemany() method requires tuple of values. therefore suggest insert new entry using following code:

conn.executemany("insert users values (?, ?, ?, ?, ?, ?)", [(email, password, first_name, last_name, date, sex)] 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -