当我运行下面的代码时,似乎显示了所提供的绑定数量不正确。当前语句使用5,提供了6个

发布于 2025-02-01 02:53:18 字数 378 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各空 2025-02-08 02:53:18

正如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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文