我正在使用gui tkinter处理数据库SQLite,问题是每当我保存数据时都会显示错误。
def save(self):
with sqlite3.connect('account.db') as db:
c = db.cursor()
# Find Existing username if any take proper action
find_info = 'SELECT * FROM user WHERE name = ?'
c.execute(find_info, [(self.name.get()), (self.StudentNumber.get()),(self.attendance.get()),(self.quiz.get()),(self.project.get()), (self.actual.get()), (self.final_exam.get()),(self.final_Grade.get())])
if c.fetchall():
ms.showerror('Error!', 'Could not find DATA.')
else:
ms.showinfo('Success!', 'Data CREATED!')
# Create New Account
insert = 'INSERT INTO user (name, student number, attendance, quizzes, project, actual examinations) VALUES(?,?,?,?,?,?,?,?)'
c.execute(insert, [(self.name.get()), (self.StudentNumber.get()), (self.attendance.get()), (self.quiz.get()),
(self.project.get()), (self.actual.get()), (self.final_exam.get()),(self.final_Grade.get())])
db.commit()
self.moon()
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\tkinter\__init__.py", line 1702, in __call__
return self.func(*args)
File "C:/Users/IAC-PC8/PycharmProjects/SKIN/OB.py", line 241, in save
c.execute(find_info, [(self.name.get()), (self.StudentNumber.get()),(self.attendance.get()),(self.quiz.get()),(self.project.get()), (self.actual.get()), (self.final_exam.get()),(self.final_Grade.get())])
sqlite3.OperationalError: no such column: name