Sep-08-2019, 12:59 PM
Hi,
I am trying to update a MSSQL Datebase from gui that i make but no what ever i do i get an error.
this is how the code looks like:
I am trying to update a MSSQL Datebase from gui that i make but no what ever i do i get an error.
this is how the code looks like:
import tkinter import pyodbc conn = pyodbc.connect("Driver={SQL Server Native Client 11.0};" "Server=ORSA\SQLEXPRESS;" "Database=ACDB;" "Trusted_Connection=yes;") def submit_12(): cursor = conn.cursor() cursor.execute(''' UPDATE ACDB.dbo.packages SET speed = spe.get WHERE pack_id = pac.get''') conn.commit() window = tkinter.Tk() window.title("GUI") tkinter.Label(window, text="Pack ID").grid(row=0) pac=tkinter.Entry(window) pac.grid(row=0, column=1) tkinter.Label(window, text="Speed").grid(row=1) spe=tkinter.Entry(window) spe.grid(row=1, column=1) tkinter.Label(window, text="start date").grid(row=2) startdate=tkinter.Entry(window) startdate.grid(row=2, column=1) tkinter.Button(window, text = "Quit", command=window.quit).grid(row=3, column=0) tkinter.Button(window, text = "Submit", command=submit_12).grid(row=3, column=1) window.mainloop()this is the errors that i get:
Error:Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:/Users/OrSa/Desktop/אקדא10000.py", line 15, in submit_12
WHERE pack_id = pac.get''')
pyodbc.ProgrammingError: ('42000', '[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The multi-part identifier "pac.get" could not be bound. (4104) (SQLExecDirectW)')