Deboparna:
私のコード:
cursor.execute("select * from PRODUCT where product_id in (?)", (ids,))
print(cursor.fetchall())
ここで、ids
整数値の組は次のようである(2,4)
とproduct_id
の値の整数でもあります。
私は取得していますエラーは次のとおりです。
fetchProductsのcursor.execute中: "/ユーザ/ deboparna /デスクトップ/大学/ Sem4 /プログラミング言語/プロジェクト/ db.py C"、ライン32、( "中PRODUCT_ID場合)(PRODUCT SELECT * FROM?"、(IDS、ファイル))sqlite3.InterfaceError:エラーバインドパラメータ0 - おそらくサポートされていないタイプ。
Vorsprung durch Technikで:
あなたは、各IDのプレースホルダが必要です。
また、単に使うべきids
タプルとして、そのタプルのタプルにしません。
placeholders = ",".join("?"*len(ids))
qry = "select * from product where product_id in ({})".format(placeholders)
cursor.execute(qry,ids)