0
エラー:のPython 3.5 sqlite3の受け渡しパラメータ - 供給バインディングの数が正しくありません
c = dbConnection.execute("SELECT compid FROM " + tableToUse + " WHERE id = ?", id) sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied.
私が行うと:
def getcompid (dbConnection, tableToUse, id):
c = dbConnection.execute("SELECT compid FROM " + tableToUse + " WHERE id = ?", id)
manualcompid = [('8','from01'),('35','28')]
for manid in manualcompid:
ERROR:
foundid = getcompid (dbConnection, tableToUse, manid[0])
OR SAME ERROR:
r = str(manid[0])
foundid = getcompid (dbConnection, tableToUse, r)
THE BELOW IS FINE:
foundid = getcompid (dbConnection, tableToUse, '8')
それは、単純な ''としてstring
同じである必要があり、私r
に縫い目8 '、more manid[0]
はすでに文字列です。なぜエラー?
なぜ私は使用する必要があります:foundid = getcompid (dbConnection, tableToUse, (manid[0],))
?
ありがとうございます。私の質問はなぜそれが '8'と一緒に働くのか? Pythonはそれを暗黙のうちにリストに変更しましたか? –