def add(self): lbr_obj = Library(self.txtBookID.get(), self.cboBookTitle.get(), self.txtAuthor.get(), self.cboMemberType.get(), self.txtFirstName.get(), self.txtSurname.get(), self.txtDateBorrowed.get(), self.txtAddress.get()) query = 'insert into management values(%s,%s,%s,%s,%s,%s,%s,%s);' values = (lbr_obj.get_BookID(), lbr_obj.get_BookTitle(), lbr_obj.get_Author(), lbr_obj.get_MemberType(), lbr_obj.get_FirstName(), lbr_obj.get_Surname(), lbr_obj.get_DateBorrowed(), lbr_obj.get_Address()) self.dbconnect.insert(query, values) messagebox.showinfo('Success', 'Data inserted successfully') self.fetch_data() self.clear()
def update(self): lbr_obj= Library(self.txtBookID.get(),self.cboBookTitle.get(),self.txtAuthor.get(), self.cboMemberType.get(),self.txtFirstName.get(),self.txtSurname.get(), self.txtDateBorrowed.get(),self.txtAddress.get()) query='update management set BookTitle=%s,Author=%s,MemberType=%s,' \ 'FirstName=%s, Surname=%s, DateBorrowed=%s, Address=%s where BookID=%s;' values=(lbr_obj.get_BookTitle(), lbr_obj.get_Author(), lbr_obj.get_MemberType(), lbr_obj.get_FirstName(), lbr_obj.get_Surname(),lbr_obj.get_DateBorrowed(), lbr_obj.get_Address(),lbr_obj.get_BookID()) self.dbconnect.update(query, values) messagebox.showinfo('Success','Data updated successfully') self.fetch_data() self.clear()