python - 插入表并得到错误: 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.
我错过了什么?
解决方案
推荐阅读
- linux - list 不会输入命令 qacct
- c# - Access to class method from other class method
- listview - 使用涉及 IfThen 的 CustomFormat
- unity3d - 当放置在另一个按钮上时,gui按钮无法点击,为什么?
- json - 使用 JSON-SERDE 将 JSON 数据摄取到 Hive
- android - 多个开关拇指图像
- javascript - 在递归节点函数中从 Mongoose 检索树数据
- python - Python Selenium Wait for user to click a button
- python - 使用 RegExp 拆分 Telegram 消息
- c - C increment pointer vs for() loop performance