Python Forum
sqlite3.OperationalError: near "=": syntax error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: sqlite3.OperationalError: near "=": syntax error (/thread-30672.html)



sqlite3.OperationalError: near "=": syntax error - Maryan - Oct-30-2020

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')
    



RE: sqlite3.OperationalError: near "=": syntax error - Maryan - Oct-31-2020

Problem solved, I forgot employee_id in cur.execute.