因這裡我在本節中的代碼應該從sql資料庫獲取一個值,然後將值添加到sql資料庫中。with sqlite3.connect('aircraft.db') as db:
c = db.cursor()
self.flightcount4 = self.flightcount5.get()
self.flightcount3 = int(self.flightcount4)
c.execute("SELECT flightcount FROM aircraft WHERE Arrive =?",(self.travelselect.get(),))
self.total3 = c.fetchone()
total2 = int(self.total3)
self.total = total2 + self.flightcount3
c.execute('UPDATE aircraft SET flightcount = :flightcount WHERE Arrive = :Arrive',{'flightcount':self.flightcount3, 'aircraftpilot':self.pilotname5 })
db.commit()
ms.showinfo('Success!', 'its saved!')
這是我的代碼。Exception in Tkinter callback
Traceback (most recent call last):
File"C:UsersadamAppDataLocalProgramsPythonPython36-
32libtkinter__init__.py", line 1702, in __call__
return self.func(*args)
File"C:A LEVELSComputingatomactual resultsworkingCustomer.py",
line 40, in addtocount
total2 = int(self.total3)
TypeError: int() argument must be a string, a bytes-like object or a
number, not 'tuple'
[Finished in 30.761s]
這是錯誤
先謝謝了