Reputation: 546
I have the following method:
def open(self, filename):
if not os.path.exists(filename):
raise IOError("Cannot find Game Database file {0}").__format__(filename)
connstr = "Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;
Data Source={0};".format(filename)
conn = adodbapi.connect(connstr)
curs = conn.cursor()
query = "Select * from Patient;"
curs.execute(query)
results = curs.fetchall()
for r in results:
print r
When this runs, the following error is rased on curs.execute(query):
(<class 'adodbapi.adodbapi.DatabaseError'>, u"(-2147352567, 'Exception occurred.', (0, u'Microsoft Cursor Engine', u'Multiple-step operation generated errors. Check each status value.', None, 0, -2147217887), None)\nCommand:\nSelect * from Patient;\nParameters:\n[]")
I can run this exact query in compactView successfully.
What obvious syntactic sugar am i not seeing? ( running: win7 pro x64, python 2.7.x, pywin32 and adodbapi installed successfully. The connection string seems to work -- i can connect and get a cursor just fine)
Upvotes: 0
Views: 2530
Reputation: 934
Using adodbapi-2.6.0.7 I solved this using the following:
connection.connector.CursorLocation = 2
For example:
import adodbapi
file = r'FILEPATH'
connection_string = (
'Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source={};'.format(file))
print(connection_string)
connection = adodbapi.connect(connection_string)
connection.connector.CursorLocation = 2
connection.get_table_names()
Upvotes: 2