Open GoogleCodeExporter opened 9 years ago
I'm not so sure that this is necessarily a bug. You are using an object named
`cursor` to iterate over the list of tables, but then you use that same object
to perform the DROP, and that messes with the state of the object. Using a
second cxn.cursor object to perform the DROP avoids the problem:
import pyodbc
cxn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb,
*.accdb)};DBQ=C:\\__tmp\\dropTest.accdb;')
cursor = cxn.cursor()
cursor2 = cxn.cursor()
for table in cursor.tables():
if table.table_type == "TABLE":
drop = "DROP TABLE [{0}]".format(table.table_name)
print drop
cursor2.execute(drop)
cxn.commit()
cxn.close()
Original comment by Gordon.D...@gmail.com
on 3 Jun 2013 at 10:32
Thank you, you are correct, and that did the trick. Clearly my novice is
showing!
Original comment by rubisc...@gmail.com
on 3 Jun 2013 at 4:03
Original issue reported on code.google.com by
rubisc...@gmail.com
on 31 May 2013 at 10:35