Problem with python prepared stmt parameter passin

2019-09-21 01:14发布

File C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mysql\connector\cursor.py, line 1149, in execute elif len(self._prepared[parameters]) != len(params): TypeError: object of type int has no len()

1条回答
时光不老,我们不散
2楼-- · 2019-09-21 01:44

The problem is python make error when we pass single parameter we need to put comma(,) at the end of first parameter. like the follwoing

input=(customerId,)
cursor.execute(sql, input)
查看更多
登录 后发表回答