In the code below the entry widgets that I use the get method to retrieve data from, have been created earlier in the code.
I have tried the following ways to solve the problem:
turning the list into a tuple
using a list literal
inserting data as variables into the database rather than as a list
getting the data from entry widgets inserting it into python variables, then I inserted the python variables into a list variable and then tried to insert this list variable into the sql database I created
# declares and defines function that checks that data in the 'Password' and ' Confirm Password' entries match
def MatchingPasswordsValidator(): if str(PasswordEntry.get())!= str(ConfirmPasswordEntry.get()): tkinter.messagebox.showerror("","Please ensure the passwords you enter match") else: # declares list variable UserDetails = 
# populates list variable
# inserts user's details into the program's database
c.executemany("INSERT INTO tblUserDetails VALUES(?,?,?,?)",UserDetails)
# saves changes made to database
File "C:\Users\User\Documents\School\CS\Project\Screen2.py", line 135, in MatchingPasswordsValidator c.executemany("INSERT INTO tblUserDetails VALUES(?,?,?,?)",UserDetails) sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 4, and there are 1 supplied.
A word of advice. Don't start variable names in Python with upper-case letters. In almost no programming language is this recommended - at least unless you're programming an old-style mainframe with punched cards!
As a general rule, objects, properties and identifiers should begin with lower case. Upper-case is reserved for things like class names (for object-oriented languages).
Your query fails because executemany wants a tuple to hold the arguments, not an array.
Try this, instead - note that I've adjusted names per recommended conventions:
I do have to ask why you are saving confirmPassword, though. You shouldn't be storing at all unless the confirmPassword is the same as password, in which case, storing 2 copies of an always-identical object is A) a waste of space and B) a potential source for bugs.
Also, another good practice is to explicitly name what you are inserting, just to avoid possible problems in the event that the database schema gets changed. And in my experience, that's quite common. So:
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
global solutions you can do at home or in your backyard