我的代码中出现错误,我无法识别问题
current_path=os.path.dirname(__file__)
find_database=os.path.join(current_path, "RDdatabase.accdb")
connection=pyodbc.connect('Driver={Microsoft Access Driver (*.mdb,
*.accdb)}; dbq=%s;' %find_database)
cursor=connection.cursor()
AMorPM = str(self.ui.timedropdown.currentText())
editedTime = str((self.ui.timelineedit.text())+" "+AMorPM)
cursor.execute("insert into
Appointments(customername,time,service)
values(?,?,?)",self.ui.customernamelineed
it.text(),editedTime,
self.ui.servicelineedit.text())
connection.commit()
connection.close()
self.clearedboxes()#function to clear boxes
QtGui.QMessageBox.about (self, 'Added to database', 'The record has been
added to the database.')
错误在插入语句中,任何帮助都将不胜感激
Traceback (most recent call last):
File "addappointment.py", line 35, in addappointment
cursor.execute("insert into Appointments(customername,time,service)values(?,?,?)"
,self.ui.customernamelineedit.text(),editedTime,
self.ui.servicelineedit.text())#inserts the values into a table
pyodbc.ProgrammingError: ('42000', '[42000]
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
(-3502) (SQLExecDirectW)')