我正在尝试从网站收集数据并将其自动导入Microsoft Access数据库。我有一个用于另一个数据库的工作脚本,但是由于某些原因,相同的代码无法正常工作。
我当前的代码是这样:
DBcursor.execute(sql, row)
其中
sql = "insert into [Wufoo Form Data]([Entry Id], [First Name], [Last
Name], [ID], [Email], [Employee], [Student], [Start Date], [End
Date], [Signed First], [Signed Last], [Today's Date], [Date Created],
[Created By], [Last Updated], [Updated By], [IP Address], [Last Page
Accessed], [Completion Status]) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?)"
和
row = ('1', 'Test', 'Form', '1234567', 'address@email.com', '
Hall Access (on ID card) for Employees', None,
'2019-07-31', '2019-08-15', 'Test', 'Form', '2019-08-01 17:58:05',
'public', None, None, None, None, None, None)
SQL语句包含19个',行包含19个参数(因此出现以下错误)。我一直未能在Stack Overflow上找到与我的错误和尝试的解决方案有关的问题。通常问题是sql语句未使用?'s传递参数,但是我正在这样做。知道发生了什么事吗?
预期结果是数据已成功导入数据库。相反,我收到以下错误:
Exception has occurred: ProgrammingError
('The SQL contains 0 parameter markers, but 19 parameters were supplied',
'HY000')