While I am trying to insert a row to my table from the Tkinter entries widgets (Entry, ComboBox, Radio Button), I'm getting the following errors:
ERROR 1136(21S01): Column count doesn't match value count at row 1.
Column names:
Course,
U_Id,
Subject,
Years,
Semester,
Student_Names,
Roll_No,
Gender,
DOB,
Email,
Mobile,
Address,
Photo
where U_Id is auto increment,
and values: crsVar.get(), sbVar.get(), yrsVar.get(), smVar.get(),nVar.get(), rollVar.get(), genVar.get(), dVar.get(), eVar.get(), mobVar.get(), adVar.get(), rdVar.get()
Please help me out, this is my code
try:
conn = mysql.connector.connect(host="localhost", username="root",
password="Sahil#12", database="attendancesystem")
c = conn.cursor()
c.execute('insert into `students_detail` values(crsVar.get(), sbVar.get(),
yrsVar.get(), smVar.get(), nVar.get(), rollVar.get(),
genVar.get(), dVar.get(), eVar.get(), mobVar.get(),
adVar.get(), rdVar.get()))
conn.commit()
conn.close()
messagebox.showinfo("Success", "Students details has been submitted",
parent=self.master)
except Exception as e:
messagebox.showerror("Error", f"Due to {str(e)}")
'
wrong – Joe Mo'''
if you are splitting a single query into multi-lines – Cool Cloud