我将mysql与python一起使用,使用绑定变量时出错。实际上我不知道如何使用绑定变量。请帮我解决我的问题
这是我的密码:
iouNo=textiv1.get()
cursor.execute("UPDATE iou_table SET IOU_status=4 WHERE IOU_No= :iouNo",{'iouNo':iouNo})
mydb.commit()
这就是我犯的错误
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':'iouNo'' at line 1
我想在SQL查询中使用iouNo变量。。。我怎么做
你可以在MySQL的manual中读到这方面的内容
%s
用作占位符如果您只有一个参数或变量,您仍然需要使用二维元组
相关问题 更多 >
编程相关推荐