【发布时间】:2021-10-20 16:29:53
【问题描述】:
def gotorasp1(self):
with pyodbc.connect(
'DRIVER=' + driver + ';SERVER=' + server + ';PORT=1433;DATABASE=' + database + ';UID=' + username + ';PWD=' + password) as coca:
with coca.cursor() as cola:
cola.execute("SELECT * FROM Data")
mac = cola.fetchone()
log = self.login.text()
pas = self.passw.text()
ind = 0
check = 0
while ind != 5:
if log == mac.Login:
if pas == mac.Password:
un = mac.Lname
check = check + 1
mac = cola.fetchone()
ind = ind + 1
if check == 1:
self.username_labl_11.setText(_translate("MainWindow", un))
self.login.setText("")
self.passw.setText("")
MainWindow.setMinimumSize(QtCore.QSize(1180, 800))
MainWindow.setMaximumSize(QtCore.QSize(16777215, 16777215))
desktop = QtWidgets.QApplication.desktop()
x = (desktop.width() - MainWindow.width()) // 2
y = (desktop.height() - MainWindow.height() - 90) // 2
MainWindow.move(x, y)
self.label_8.setStyleSheet("font: 9pt \"Montserrat\";\n""color:white")
self.stackedWidget1.setCurrentWidget(self.page_2)
self.comboBox.setItemText(0, _translate("MainWindow", dw + " " + today.strftime("%d.%m.%Y")))
cursor.execute(f"SELECT * FROM [dbo].[September] WHERE Day = {t}")
row = cursor.fetchone()
...
此错误出现在这一行:
mac = cola.fetchone()
而我,作为一个不是特别精通这个话题的人,绝对不能理解为什么。
我将非常感谢任何答案。
【问题讨论】: