• Register
0 votes
1.6k views

Problem :

I am using the sqlite3 to store the values into database, My problem is that I have created lineedits through which I am trying to extract values and store it to the variables and pass this variables to the insert query but i am facing below error at line values(?,?,?,?,?)......

“Sqlite3.interfaceerror: error binding parameter 0 - probably unsupported type.”

If I just hard quote the values directly to variables it gets saved into my database what is the mistake am I doing in my code?

Below is my code:

self.uname = self.le1.text()
self.passwd = self.le2.text()
self.permssn = self.le3.text()
self.queryCurs.execute('''CREATE TABLE IF NOT EXISTS USER
(USERNAME TEXT NOT NULL, PASSWORD TEXT NOT NULL, PERMISSION TEXT NOT NULL)''')
self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) 
VALUES(?,?,?)''',(self.uname,self.passwd,self.permssn))
print ('inserted row')
self.createDb.commit()

Any solution on my error?

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

The method from where you are trying to get the text "le1.text()", doesn't stores your value in the string format. I was facing the same error, sorted out that the data type was mismatched. I converted my value to string and it worked fine for me.

Also please don't miss to add comma at the end because your execute query takes tulip as shown below:

self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) VALUES(?,?,?)''',(str(self.uname),str(self.passwd),str(self.permssn),))

 

9 7 4
38,600 points

Related questions

0 votes
1 answer 15 views
15 views
Problem: Any solution on my error:Sqlite3.interfaceerror: error binding parameter 0 - probably unsupported type .
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 4 views
4 views
Problem: the error message says TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int' thanks for any insight you can provide...
asked 4 days ago ummesalma 25.2k points
0 votes
1 answer 15 views
15 views
Problem: I am facing following error: post data should be bytes, an iterable of bytes, or a file object. it cannot be of type str.
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 1.8K views
1.8K views
Problem : I am trying to convert my working Python 2.7 code into Python 3 code but I am facing following error post data should be bytes, an iterable of bytes, or a file object. it cannot be of type str.
asked Nov 16, 2019 peterlaw 6.9k points
0 votes
1 answer 79 views
79 views
Problem: error: (-215:assertion failed) !empty() in function 'cv::cascadeclassifier::detectmultiscale'
asked Feb 19 Lucky Guy 1.5k points
0 votes
1 answer 466 views
466 views
Problem : When I executed: pip install xgboost I got this: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/w4/w49s3mn91plbhyjwf8qjkpxc0000gn/T/pip-build-61dms1/xgboost/
asked Oct 21, 2019 peterlaw 6.9k points
0 votes
2 answers 974 views
974 views
Problem : On installing Anaconda on Ubantu getting below Python error on miss-typed commands fatal python error: py_initialize: unable to get the locale encoding
asked Oct 21, 2019 peterlaw 6.9k points
1 vote
1 answer 14 views
14 views
Problem : I'm working on a project using sqlite3 database.I runs and passes it the database: /tmp/cer/could.db The unit test program can make the db without any problem. But, when I actually use the program passing the same location to it, i got below error: OperationalError: unable to open database file
asked Mar 4 Shovo210 14k points
0 votes
1 answer 2 views
2 views
Problem: I'm a complete noob when it comes to programming and having an issue with python maths. If I run the following line of code, python returns 97 as the answer.
asked 3 days ago ummesalma 25.2k points
0 votes
1 answer 3 views
3 views
Problem: How to add 50 to the number stored under the 'gold' key?
asked 3 days ago ummesalma 25.2k points