我在嘗試使用類似查詢的sqlite3
db使用python時出現以下錯誤。在Python中使用參數化查詢時獲取錯誤
Error:
Request Method: POST
Request URL: http://127.0.0.1:8000/search/
Django Version: 1.11.2
Exception Type: ProgrammingError
Exception Value:Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied.
我下面解釋我的查詢。
rname = request.POST.get('rname')
keyword = '%' + rname + '%'
cursor.execute("SELECT * FROM booking_meeting WHERE room_name LIKE ? ",(keyword))
在這裏,我需要從每個關鍵字的表中獲取值。請幫我解決這個錯誤。
請停止使用原始的SQL像這樣瑣碎的查詢。 –