每当我执行此功能时,程序都会生成一个错误。
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)
这是导致错误的特定行:
mycursor.execute(sqlcommandU,UserID)
这很奇怪,因为在usercredentials表中仅插入了一个数据条目。