我目前正在做一个项目,需要一个登录系统,可以通过使用sqlite3的数据库访问信息(用户名、密码)。以下是当前登录系统:
def UserLogin():
un = admin
pw = password
try:
statement = cur.execute("SELECT Username FROM Users")
for row in statement:
if un in row:
print("%s" % un)
pw_pas = cur.execute("SELECT Password FROM Users WHERE Username = %s" % (un))
if (pw in pw_pas):
print("Welcome\n")
elif pw not in pw_pas:
print("Password is incorrect")
return
print("Username is incorrect")
except IOError:
print("This process could not be executed")
print("login successful")
问题是,当我运行代码时,我得到一条错误消息,说“sqlite3.OperationalError:no-this column:admin”。我已经在数据库中输入了用户名和密码,但是仍然出现这个错误。在
请帮忙
不要对SQL语句使用字符串替换。使用参数。在
相关问题 更多 >
编程相关推荐