sqlite3.InterfaceError:错误绑定参数0-可能不受支持的类型。 -登录页面

我试图制作一个登录页面,并遇到此错误。我目前正在努力使程序检查数据库文件中他们创建的用户ID,以便他们可以登录,但出现此错误:

  

sqlite3.InterfaceError:错误绑定参数0-可能是不受支持的类型。

几个小时后我似乎无法正常工作,所以我来这里寻求帮助。

引起问题的函数是:login_verify() 导致错误的行已用注释标记

错误图片:

sqlite3.InterfaceError:错误绑定参数0-可能不受支持的类型。 -登录页面

数据库图片:

sqlite3.InterfaceError:错误绑定参数0-可能不受支持的类型。 -登录页面

from tkinter import *
import sqlite3

root = Tk()
root.geometry('500x500')
root.title("Bank Portal")

Fullname=StringVar()
Email=StringVar()
Gender=StringVar()
c=StringVar()
var1= IntVar()
ID=IntVar()

def main_screen_destroy():

   root.destroy()
   login()

def login_screen_destroy():

   login.destroy()
   activity()





def activity():

   activity = Tk() # Line that is creating error
   activity.geometry('500x350')
   activity.title("Bank Portal")

   label_9 = Label(activity,text="account Transaction",width=20,font=("bold",20))
   label_9.place(x=70,y=53)

   Button(activity,text='Balance',bg='blue',fg='white',command=quit).place(x=180,y=250)
   Button(activity,text='Deposit',y=280)
   Button(activity,text='Withdraw',y=310)

   activity.mainloop()



def login():  # New page 

   login = Tk() # Line that is creating error
   login.geometry('500x350')
   login.title("Bank Portal")

   label_5 = Label(login,text="account Login",20))
   label_5.place(x=70,y=53)

   label_6 = Label(login,text="ID Number",10))
   label_6.place(x=80,y=130)

   entry_7 = Entry(login,textvar=ID)
   entry_7.place(x=220,y=130)

   label_8 = Label(login,text="Email ",10))
   label_8.place(x=82,y=180)

   entry_8 = Entry(login,textvar=Email)
   entry_8.place(x=220,y=180)

   Button(login,text='Submit',command=login_verify).place(x=180,y=250)

   login.mainloop()


def login_verify(): 

   global ID

   with sqlite3.connect('Form.db')as db:

      cursor=db.cursor()
      finduser=('SELECT * FROM Users WHERE ID = ?')
      cursor.execute(finduser,(ID,)) #line causing error


   if cursor.fetchall():
      login_screen_destroy()

   else:
      login.destroy()



def database():

   name1=Fullname.get()
   email=Email.get()
   gender=Gender.get()
   country=c.get()

   iD=ID.get()

   conn = sqlite3.connect('Form.db')

   with conn:
      cursor=conn.cursor()
   cursor.execute('CREATE TABLE IF NOT EXISTS Users (Fullname TEXT,Email TEXT,Gender TEXT,country TEXT,ID TEXT)')
   cursor.execute('INSERT INTO Users (FullName,Email,Gender,country,ID) VALUES(?,?,?)',(name1,email,gender,iD))
   conn.commit()


label_0 = Label(root,text="account Registration",20))
label_0.place(x=90,y=53)

label_1 = Label(root,text="Full Name",10))
label_1.place(x=80,y=130)

entry_1 = Entry(root,textvar=Fullname)
entry_1.place(x=240,y=130)

label_1 = Label(root,y=160)

entry_1 = Entry(root,textvar=ID)
entry_1.place(x=240,y=160)

label_2 = Label(root,text="Email Address",10))
label_2.place(x=68,y=210)

entry_2 = Entry(root,textvar=Email)
entry_2.place(x=240,y=210)

label_4 = Label(root,text="Gender",10))
label_4.place(x=70,y=260)

list2 = ['Male','Female','Prefer not to say'];

droplist=Optionmenu(root,*list2)
droplist.config(width=15)
Gender.set('Select your gender') 
droplist.place(x=240,y=260)

label_4 = Label(root,text="Country",y=310)

list1 = ['Australia','India','England','USA','New Zealand','China','Japan','Singapore','Hong Kong','North Korea','South Korea','Germany','Italy','Greece','France'];

droplist=Optionmenu(root,c,*list1)
droplist.config(width=15)
c.set('Select your country') 
droplist.place(x=240,y=310)

Button(root,bg='brown',command=database).place(x=180,y=380)
Button(root,text='Login',command=main_screen_destroy).place(x=180,y=420)

root.mainloop()
e5557c 回答:sqlite3.InterfaceError:错误绑定参数0-可能不受支持的类型。 -登录页面

该错误消息表明find的类型不受支持。
您定义了-0,因此请尝试使用xargs方法:

ID
本文链接:https://www.f2er.com/3159653.html

大家都在问