sql
is a tuple but cursor.execute()
requires a SQL string and a tuple/list arguments.
Also you should get the content of search_box
inside search_product_name()
:
def search_product_name():
search_box_get = search_box.get()
connection = sqlite3.connect("database.db")
cursor = connection.cursor()
sql = "SELECT * FROM products WHERE product_name = ?"
all_rows = cursor.execute(sql, [search_box_get])
...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…