Skip to content

Incorrect number of bindings supplied. The current statement uses 1, and there are 0 supplied. #1

Description

@CXX22

I am currently having an issue.

I use the usual insertion query:

(Mydatabase connection here and it's okay)

My Insertion sql query code:

cursor.execute("INSERT INTO table(surname, othername, dept, course) VALUES(?,?,?,?)",
(
self.surnamefield.text(),
self.othernamefield.text(),
self.deptfield.text(),
self.coursefield.text()
)
self.conn.commit

Whenever I try to insert values from my GUI, it comes up with an error message:

Incorrect number of bindings supplied. The current statement uses 1, and there are 0 supplied.


My code works perfectly fine on Microsoft SQL server and MySql server. I don't know why SQLite is giving me problem.

I have tried to use: VALUES[?,?,?,?,] it gave same error message.

I also tried;

[

self.surnamefield.text(),
self.othernamefield.text(),
self.deptfield.text(),
self.coursefield.text()
]

It also gave same error message.

I tried:

[

self.surnamefield.text(),
self.othernamefield.text(),
self.deptfield.text(),
self.coursefield.text(),
]

It also gave same error message.

I am using Python and SQLite3

Have you any clue on how to resolve it please? If yes, kindly suggest it here. Thanks

sqlite insert

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions