0
def insert(self):
    con = mysql.connect(host="localhost",
                            user='root',
                            password='*******',
                            db="bill")
    cur = con.cursor()
    cur.execute(
        "insert into billing values(%d,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",
        (
            self.bill_no.get(),
            self.c_name.get(),
            self.c_phon.get(),
            self.c_address.get(),

            self.soap.get(),
            self.face_cream.get(),
            self.face_wash.get(),
            self.spray.get(),
            self.gell.get(),
            self.loshan.get(),

            self.rice.get(),
            self.food_oil.get(),
            self.daal.get(),
            self.wheat.get(),
            self.sugar.get(),
            self.tea.get(),

            self.maza.get(),
            self.cock.get(),
            self.frooti.get(),
            self.thumbsup.get(),
            self.limca.get(),
            self.sprite.get(),

            self.cosmatic_price.get(),
            self.grocery_price.get(),
            self.cold_drink.get(),
            self.cosmatic_tax.get(),
            self.grocery_tax.get(),
            self.cold_tax.get(),

        )
        )

    con.execute("commit");
    con.close()
    messagebox.showerror("Success", "Record Added Successfully")

when i run my code i got this error "Not all parameters were used in the SQL statement" how should i fix that ? except c_name and c_address all of others are my integer values but why this is showing like this. even i add %s and %d over here if i donot specify the type then still remains the same error

khelwood
  • 52,115
  • 13
  • 74
  • 94
  • I think all your `%d` should be `%s`. That is the placeholder for parameter substitution with mysql.connector. – khelwood Nov 20 '21 at 17:50

0 Answers0