【发布时间】:2021-09-23 14:07:30
【问题描述】:
我已连接到数据库并遍历元数据以获取表名,每次删除表。但是我收到错误消息:
pyodbc.ProgrammingError: ('42S02', "[42S02] [Microsoft][ODBC Microsoft Access Driver] Table 'MSysAccessStorage' does not exist. (-1305) (SQLExecDirectW)")
这没有意义,因为我从数据库中获取表名,所以它必须存在。我的连接必须正常工作以获取表名和我的代码的其他部分,例如插入工作。这是我的代码:
for row in cursor.tables():
if(str(row.table_name)!="pricesBackup" and str(row.table_name)!="recipesBackup"):
sqlLine="DROP TABLE costingDB1.accdb." + row.table_name
print(sqlLine)
cursor.execute(sqlLine)
conn.commit()
这对我来说似乎很奇怪,想知道如何解决这个问题。提前谢谢你
【问题讨论】: