【问题标题】:How to pass multiple argument to multiple columns in sqlite3?如何将多个参数传递给 sqlite3 中的多个列?
【发布时间】:2021-07-21 07:31:46
【问题描述】:

我只想将多个变量传递给多个列来更新它,但我不确定我的语法是否正确,也不知道如何在 SET 和 WHERE 命令上传递参数。

query = 'UPDATE locker SET title = ?, category = ?, name = ?, link = ?, username = ?, password = ?, note= ? WHERE title = ? AND account_id = ?'
cur.execute(query, ??)

【问题讨论】:

  • 请始终只使用相关标签(您的问题与 PyQt 无关,您在程序中使用它的事实无关紧要)。

标签: python database sqlite parameter-passing


【解决方案1】:

这对我来说很好用

cur.execute(query, (par1, par2, .., parN))

【讨论】:

    猜你喜欢
    • 2020-11-07
    • 1970-01-01
    • 2018-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多