Not all parameters are used

0 votes
def update_data(self):

        if self.var_dep.get()=='Select Department' or self.var_std_name.get()=='' or self.var_std_id.get()=="":

            messagebox.showerror('Error','All fields are required',parent=self.root)

        else:

            try:

                upadate=messagebox.askyesno('Update', 'Do you want to update this student details',parent=self.root)

                if upadate>0:

                    conn=mysql.connector.connect(host='localhost',username='root',password='1234',database='face_recognizer')

                    my_cursor=conn.cursor()

                    my_cursor.execute('update student set Dep=%s,course=%s,year=%s,semester=%s,Division=%s,Roll=%s,Gender=%s,Dob=%s,Email=%s,Phone=%s,Address=%s,Lecturer=%s,PhotoSample=%s where student_id=%s',(

                                                     

                                                                                                                                                                                    self.var_dep.get(),

                                                                                                                                                                                    self.var_course.get(),

                                                                                                                                                                                    self.var_year.get(),

                                                                                                                                                                                    self.var_semester.get(),

                                                                                                                                                                                    self.var_std_name.get(),

                                                                                                                                                                                    self.var_div.get(),

                                                                                                                                                                                    self.var_roll.get(),

                                                                                                                                                                                    self.var_gender.get(),

                                                                                                                                                                                    self.var_dob.get(),

                                                                                                                                                                                    self.var_email.get(),

                                                                                                                                                                                    self.var_phone.get(),

                                                                                                                                                                                    self.var_address.get(),

                                                                                                                                                                                    self.var_lecturer.get(),

                                                                                                                                                                                    self.var_radio1.get(),

                                                                                                                                                                                    self.var_std_id.get()

                                                                                                                  ))

                else:

                    if not upadate:

                        return

                messagebox.showinfo('Success','Student details successfully update completed',parent=self.root)  

                conn.commit()

                self.fetch_data()

                conn.close()

                 

            except Exception as es:

                messagebox.showerror('Error',f'Due To:{str(es)}',parent=self.root)
Feb 10, 2023 in Python by Aryazayo

edited 5 days ago 11 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP