def modify(self):
if self.CASE_NAME.get() and self.Buying_Price.get() and self. \
Selling_Price.get() and self.price_piece.get() is not None:
print('none is none')
try:
c.execute("SELECT * FROM Cases WHERE CaseName = '%s'" % str(self.CASE_NAME.get()))
arr = c.fetchone()
print(arr)
if arr is not None:
c.execute("UPDATE Cases SET BuyingPrice = %s , SellingPrice = %s WHERE CaseName = %s",
(int(self.Buying_Price.get())), int(self.Selling_Price.get()), str(self.CASE_NAME.get()))
c.execute('Update Cases set PiecePrice = %s',(int(self.price_piece.get()),str(self.CASE_NAME.get())))
conn.commit()
print('updated succesfully!!')
except:
print("item couldn't be found")
else:
出现以下错误
none is none (26, 'Soda', 0, '500ml', 1000, 1020, 50, 0) item couldn't be found ms.showwarning('Empy Fields','Make sure all fields are entered')
答案 0 :(得分:0)
def modify(self):
if self.CASE_NAME.get() and self.Buying_Price.get() and self. \
Selling_Price.get() and self.price_piece.get() is not None:
print('none is none')
try:
c.execute("SELECT * FROM Cases WHERE CaseName = '%s'" % str(self.CASE_NAME.get()))
arr = c.fetchone()
print(arr)
if arr is not None:
print('executing')
c.execute(
"UPDATE Cases SET BuyingPrice = %s , SellingPrice = %s , PiecePrice = %s WHERE CaseName = %s",
(int(self.Buying_Price.get()), int(self.Selling_Price.get()),
int(self.price_piece.get()), str(self.CASE_NAME.get())))
conn.commit()
print('updated succesfully!!')