我已经有这个MySQL错误很长一段时间了。我似乎无法理解为什么它一直发生,我已导入我的数据库文件与所有正确的信息进行连接但由于某种原因仍然会发生错误。我有类似的功能分散在我的项目中,我从来没有得到这个错误,它实际上是逐字复制,但我仍然得到这个错误。如果有人能指出我正确的方向,我会非常感激,因为我在网上没有运气。
感谢。
代码:
def membership_reactivation(self):
connection.connect(user="root", password="")
email = self.EmailBox.get()
password = self.PasswordBox.get()
query = "UPDATE users SET Status = 'ACTIVE' WHERE Email = %s AND Password = %s;"
cursor.execute(query, (email, password,))
result = cursor.fetchall()
if result:
connection.commit()
connection.close()
self.controller.show_frame("ThankYou")
else:
print("Credentials Not Found in Database.")
connection.close()
错误讯息:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\AJE\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__
return self.func(*args)
File "C:\Users\AJE\PycharmProjects\ReactivateMembership.py", line 58, in membership_reactivation
result = cursor.fetchall()
File "C:\Users\AJE\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mysql\connector\cursor.py", line 1002, in fetchall
raise errors.InterfaceError("No result set to fetch from.")
mysql.connector.errors.InterfaceError: No result set to fetch from.