Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

tkinter - I want to get an error message on entering wrong value inside a entrybox but instead I get an success message on every entry

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')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...