I have a code where I input a wrong value or a value which is not situated in the database and I want an error message box to show up But instead, I get an error Messagebox on every entry given in the entry box Please Provide a solution to this issue even though the entry given is not located in the database
def deldata(self):
self.a=self.entry4.get()
cursor=dd.cursor()
cursor.execute("DELETE FROM stbook WHERE Book_ID='"+self.a+"'")
dd.commit()
self.da=cursor.fetchone()
if self.da!=None:
messagebox.showinfo('Hotel System','Guest is Deleted successfully !')
else:
messagebox.showerror('Hotel System','Guest is not Found in Database')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…