Код: Выделить всё
def login_successful():
if usernameEntry.get()=='' or passwordEntry.get()=='' or passwordEntry.get()=='Password':
messagebox.showerror("Error", "Missing details")
else:
connection = pyodbc.connect('DRIVER={SQL Server};' +
'SERVER=LAPTOP-D74DF11D;' +
'Database=userdata;' +
'Trusted_Connection=Yes')
connection.autocommit = YES
connection.execute("IF EXISTS (SELECT * FROM Data Where username = f"'{usernameEntry.get()}'" and pass = f"'{passwordEntry.get()}'")")
messagebox.showinfo("Success!", "Account Successfully Created!")
Подробнее здесь: https://stackoverflow.com/questions/792 ... sql-server
Мобильная версия