Python Forum

Full Version: sqlite3.OperationalError: near "=": syntax error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't find anything wrong with the query, but yet is not working. Any help is appreciated!

Exception in Tkinter callback
Traceback (most recent call last):
  File "E:\Python\lib\tkinter\__init__.py", line 1885, in __call__
    return self.func(*args)
  File "c:\Users\User\Desktop\Employment Application\myemployees.py", line 412, in updateEmployee
    cur.execute(query,(name, surname, address, phone, email, age, position, salary, employment, education, criminalr, vacation, citizenship, notes, date_start, date_end, ssn, duties))
sqlite3.OperationalError: near "=": syntax error
PS C:\Users\User\Desktop\Employment Application>
 
        if (name, surname, address, phone, email, age != ''):
            try:
                query = "UPDATE 'employees' SET (employee_name=?, employee_lastname=?, employee_address=?, employee_phone=?,employee_email=?, employee_age=?) WHERE employee_id = ?"
                cur.execute(query,(name, surname, address, phone, email, age))
                con.commit()
                messagebox.showinfo('Success!', 'The new employee is successfully added!', icon = 'info')

            except EOFError as e:
                print(e)
                messagebox.showerror('Error', 'Fatal Error Occurred!', icon = 'error')
        
        else:
            messagebox.showwarning('Warning', 'Feilds can NOT be empty!', icon = 'warning')
    
Problem solved, I forgot employee_id in cur.execute.