Skip to content Skip to sidebar Skip to footer

How Do I Correctly Query A Sql Ce 4.0 Database File Using Adodbapi?

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) c

Solution 1:

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()

Solution 2:

It could be that one of the table columns you are selecting is of type NVARCHAR(N) where N is larger than 127 [1]. Using the server-side cursor will solve the problem.

conn.adoConn.CursorLocation = adodbapi.adUseServer

Post a Comment for "How Do I Correctly Query A Sql Ce 4.0 Database File Using Adodbapi?"