Not sure which sub-form to post in, so general it is!
I am connecting to a small (only 3 table) access database (2016, .accdb) using an ODBC driver from Python. I am trying to run an parameterized query and am getting an error when I try. From what I have been able to find, it is saying that the ODBC driver does not allow parameterized queries. Can someone confirm that per chance?
Its not VBA, but here is my code for those interested:
There error in question is on cursor.execute and is:
Anyone happen to have any idea?
I am connecting to a small (only 3 table) access database (2016, .accdb) using an ODBC driver from Python. I am trying to run an parameterized query and am getting an error when I try. From what I have been able to find, it is saying that the ODBC driver does not allow parameterized queries. Can someone confirm that per chance?
Its not VBA, but here is my code for those interested:
Python:
import pyodbc
import os
def db_connection():
access_file_path = #chopped out for posting
connection = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=' + access_file_path)
cursor = connection.cursor()
return connection, cursor
def db_order_parameters(selected_order):
connection, cursor = db_connection()
cursor.execute(
'''SELECT tblParameters.DroppedRows, tblParameters.DroppedStatus, tblParameters.Tracking
FROM tblOrders INNER JOIN tblParameters ON tblOrders.ID = tblParameters.ID_Order
WHERE tblOrders.OrderNumber = ?
''', (selected_order, )
)
parameters = cursor.fetchone()
cursor.close()
connection.close()
print(parameters)
return parameters
There error in question is on cursor.execute and is:
Code:
Exception has occurred: Error
('HYC00', '[HYC00] [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented (106) (SQLBindParameter)')
Anyone happen to have any idea?