当我运行下面的代码时,似乎显示了所提供的绑定数量不正确。当前语句使用5,提供了6个
def search(name="", address="",phone_number="",no_of_days="",room_types="",total=""):
conn=sqlite3.connect("hot.db")
cur=conn.cursor()
cur.execute("SELECT * FROM hot WHERE name=? OR address=? OR phone_number=? OR room_type=? OR total=?",(name, address, phone_number, no_of_days, room_types, total))
当我尝试单击GUI上的搜索按钮时,上面的错误出现。我不知道错过了什么。
def search(name="", address="",phone_number="",no_of_days="",room_types="",total=""):
conn=sqlite3.connect("hot.db")
cur=conn.cursor()
cur.execute("SELECT * FROM hot WHERE name=? OR address=? OR phone_number=? OR room_type=? OR total=?",(name, address, phone_number, no_of_days, room_types, total))
When I try clicking a search button on the GUI the error above appears. I don't know what am Missing out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如Matthias已经提到的那样,您缺少第六位占位符。具体来说,您需要添加
或no_of_days =?
,因为您提供了6个值,但在查询中只有5位占位符。As Matthias already mentioned, you are missing the 6th placeholder. Specifically, you'll need to add
OR no_of_days = ?
since you provide 6 values but only 5 placeholders in your query.