MySQL: Not all parameters were used in the SQL statement

Viewed 32

I have created a student record for CRUD operation with MySQL database, and I decided to create a button to perform multiple deletions for all outdated data. Unfortunately, when I set out the delete_many function, I encountered the following error. All my data display in Tkinter Treeview as a record table.

def delete_many():
    response = messagebox.askyesno("WOAH!!", "This will delete SELECTED From the Table")
    if response == 1:
    
        # Designate selections
        selected = record_table.selection()
        
        ids_to_delete = [] 
        
        # Add selections to ids_to_delete list
        for record in selected:
            ids_to_delete.append(record_table.item(record, 'values'))
            record_table.delete(record)
        
  
         # connect database
        mydb = mysql.connector.connect(
        host = 'localhost',
        database = 'students',
        user = 'root',
        password = '',
        auth_plugin=''
        )
        
        mycursor = mydb.cursor()
        
        sql_command = '''DELETE FROM student WHERE student_id = %s'''
        value = ([(b) for b in ids_to_delete])
      
        mycursor.executemany(sql_command, value)
        
        ids_to_delete = []
                
        mydb.commit()
        mydb.close()

     mycursor.executemany(sql_command, value)
  File "D:\Tkinter\tkinter_venv\lib\site-packages\mysql\connector\cursor_cext.py", line 375, in executemany
    self.execute(operation, params)
  File "D:\Tkinter\tkinter_venv\lib\site-packages\mysql\connector\cursor_cext.py", line 271, in execute
    raise ProgrammingError(
mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement.

Why was this error incurred? How to fix them?

0 Answers
Related