python - sqlite InterfaceError: Error binding parameter 0 - probably unsupported type

Multi tool use
i am using sqlite3 to store values into database, My problem is i have created lineedits through which i extract values and store it to variables and pass this variables to insert query but i am getting above error at line values(?,?,?,?,?)......if i hard quote the values directly to variables it gets saved into database what is the mistake am i doing? please help.......here 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()
where am i going wrong?
python-2.7 sqlite3
add a comment |
i am using sqlite3 to store values into database, My problem is i have created lineedits through which i extract values and store it to variables and pass this variables to insert query but i am getting above error at line values(?,?,?,?,?)......if i hard quote the values directly to variables it gets saved into database what is the mistake am i doing? please help.......here 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()
where am i going wrong?
python-2.7 sqlite3
add a comment |
i am using sqlite3 to store values into database, My problem is i have created lineedits through which i extract values and store it to variables and pass this variables to insert query but i am getting above error at line values(?,?,?,?,?)......if i hard quote the values directly to variables it gets saved into database what is the mistake am i doing? please help.......here 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()
where am i going wrong?
python-2.7 sqlite3
i am using sqlite3 to store values into database, My problem is i have created lineedits through which i extract values and store it to variables and pass this variables to insert query but i am getting above error at line values(?,?,?,?,?)......if i hard quote the values directly to variables it gets saved into database what is the mistake am i doing? please help.......here 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()
where am i going wrong?
python-2.7 sqlite3
python-2.7 sqlite3
asked Jan 20 '14 at 10:17
darshan kataridarshan katari
37211
37211
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The method from where you're getting the text "le1.text()", doesn't stores the value in string format. I was getting the same error, sorted out that my data type was mismatched. I converted this value to string and it worked fine.
Also don't miss to add comma in the end because the execute query takes tulip.
self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION)
VALUES(?,?,?)''',(str(self.uname),str(self.passwd),str(self.permssn),))
add a comment |
Values should be in touple (square brackets), like this:
self.queryCurs.execute("INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Since you add values at the same order as columns in your table are, you don't really need them in your query, so this will also work:
self.queryCurs.execute("INSERT INTO USER VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21231264%2fpython-sqlite-interfaceerror-error-binding-parameter-0-probably-unsupported%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The method from where you're getting the text "le1.text()", doesn't stores the value in string format. I was getting the same error, sorted out that my data type was mismatched. I converted this value to string and it worked fine.
Also don't miss to add comma in the end because the execute query takes tulip.
self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION)
VALUES(?,?,?)''',(str(self.uname),str(self.passwd),str(self.permssn),))
add a comment |
The method from where you're getting the text "le1.text()", doesn't stores the value in string format. I was getting the same error, sorted out that my data type was mismatched. I converted this value to string and it worked fine.
Also don't miss to add comma in the end because the execute query takes tulip.
self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION)
VALUES(?,?,?)''',(str(self.uname),str(self.passwd),str(self.permssn),))
add a comment |
The method from where you're getting the text "le1.text()", doesn't stores the value in string format. I was getting the same error, sorted out that my data type was mismatched. I converted this value to string and it worked fine.
Also don't miss to add comma in the end because the execute query takes tulip.
self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION)
VALUES(?,?,?)''',(str(self.uname),str(self.passwd),str(self.permssn),))
The method from where you're getting the text "le1.text()", doesn't stores the value in string format. I was getting the same error, sorted out that my data type was mismatched. I converted this value to string and it worked fine.
Also don't miss to add comma in the end because the execute query takes tulip.
self.queryCurs.execute('''INSERT INTO USER(USERNAME, PASSWORD, PERMISSION)
VALUES(?,?,?)''',(str(self.uname),str(self.passwd),str(self.permssn),))
answered Apr 28 '16 at 7:10


Anum SherazAnum Sheraz
547415
547415
add a comment |
add a comment |
Values should be in touple (square brackets), like this:
self.queryCurs.execute("INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Since you add values at the same order as columns in your table are, you don't really need them in your query, so this will also work:
self.queryCurs.execute("INSERT INTO USER VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
add a comment |
Values should be in touple (square brackets), like this:
self.queryCurs.execute("INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Since you add values at the same order as columns in your table are, you don't really need them in your query, so this will also work:
self.queryCurs.execute("INSERT INTO USER VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
add a comment |
Values should be in touple (square brackets), like this:
self.queryCurs.execute("INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Since you add values at the same order as columns in your table are, you don't really need them in your query, so this will also work:
self.queryCurs.execute("INSERT INTO USER VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Values should be in touple (square brackets), like this:
self.queryCurs.execute("INSERT INTO USER(USERNAME, PASSWORD, PERMISSION) VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
Since you add values at the same order as columns in your table are, you don't really need them in your query, so this will also work:
self.queryCurs.execute("INSERT INTO USER VALUES(?,?,?)",[self.uname, self.passwd, self.permssn])
answered May 30 '14 at 19:07
AleksandarAleksandar
2,13831946
2,13831946
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
add a comment |
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
Tuples use parentheses, and work just fine.
– CL.
Aug 24 '14 at 16:26
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
not for me, I've tested his code and it worked only when I've changed it like in my answer
– Aleksandar
Aug 25 '14 at 6:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21231264%2fpython-sqlite-interfaceerror-error-binding-parameter-0-probably-unsupported%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
rUt5,SkKOPRAZWd,cNAwkHINnv3d9pKvelEDx 8UTW m1lMqf cMBN7HM0UA