值错误:无法处理参数MySQL Python

2024-10-02 18:14:30 发布

您现在位置:Python中文网/ 问答频道 /正文

每当我执行这个函数时,我的程序就会生成一个错误。在

def SubmitDetailsL ():
LeaderID=random.randint(1,10000)
print(LeaderID)
UserID=random.randint(1,10000)
print(UserID)
UserID=str(UserID)
sqlcommand="INSERT INTO leaderinfo (leaderID, firstname,secondname,age,gender,ethnicity,address,postcode,telephone,email,userID) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
LeaderInput= (LeaderID,FName.get(),SName.get(),Age.get(),Gender.get(),Ethnicity.get(),Address.get(),Postcode.get(),TelephoneNum.get(),Email.get(),UserID)
mycursor.execute(sqlcommand,LeaderInput)
mydb.commit()
print("Completed Transaction")
sqlcommandU="INSERT INTO usercredentials (userID) VALUES (%s)"
mycursor.execute(sqlcommandU,UserID)
mydb.commit()
print("Completed Transaction")
raise_frame(Credentials)
return(UserID)

这是导致错误的特定行:

^{pr2}$

这看起来很奇怪,因为只有一个数据条目被插入到usercredentials表中。在


Tags: executeget错误randominsertvaluesprintrandint