首页 > 解决方案 > 插入表并得到错误: sqlite3.ProgrammingError: You did not provide a value for binding 1

问题描述

我已经提供了所有的值。仍然给我一个错误,我没有为绑定 1 提供值。这是我的代码:

 conn = sqlite3.connect('Minerva_app.db')
        c = conn.cursor()
        c.execute("""
                    INSERT INTO tbl_contracts(contractName, category_id, startDate, endDate, price, periods, dateCreated
                        , dateUpdated, notes, activeStatus, file_id) 
                     VALUES(:contractName1, :category1, :startDate1, :endDate1, :price1, :periods1, :dateCreated1
                     , :dateUpdated1, :notes1, :activeStatus1, :file_id1)
                """,
                  {
                      ':contractName1': self.contactNameEntry.get(),
                      ':category1': cat_id,
                      ':startDate1': self.startDateEntry.get(),
                      ':endDate1': self.endDateEntry.get(),
                      ':price1': self.priceEntry.get(),
                      ':periods1': self.periodsEntry.get(),
                      ':dateCreated1': now,
                      ':dateUpdated1': now,
                      ':notes1': self.notesText.get("1.0", tk.END),
                      ':activeStatus1': self.active.get(),
                      ':file_id1': file_id1
                  }
                  )
        conn.commit()
        conn.close()

这是错误:

    ':file_id1': file_id1
sqlite3.ProgrammingError: You did not supply a value for binding 1.

我错过了什么?

标签: pythonpython-3.xsqlite

解决方案


推荐阅读