Adrián Panella
2015-05-05 01:13:23 UTC
Hi, I'am trying to use adodbapi to wrap a connection to an .accdb MS Access database and I'm getting an error when executing a query with a date parameter.For what I could deduce the problem is that it converts to COMDate only if "settings_known" is set, which seems not to be the case for Access querys, and defaults to assuming that the parameter is a string even if it is a datetime object.
I have solved the problem changing the following lines of code in adodbapi.py (in function _configure_parameter):
195 elif type(value) in dateconverter.types: 196 (old) #if settings_known and adotype in api.adoDateTimeTypes: 196 (new) if adotype in api.adoDateTimeTypes: 197 p.Value = dateconverter.COMDate(value) 198 else: #probably a string
This works but it is not very portable as it requires to change library code on each installation.
Any suggestions?
I have also tried running it as a stored procedure (with callproc), but in that case it tries to retrieve paramenter information (cmd.Parameters.Refresh). Which it does without error but getting all blanks. So it doesnŽt work either.
Thanks
I have solved the problem changing the following lines of code in adodbapi.py (in function _configure_parameter):
195 elif type(value) in dateconverter.types: 196 (old) #if settings_known and adotype in api.adoDateTimeTypes: 196 (new) if adotype in api.adoDateTimeTypes: 197 p.Value = dateconverter.COMDate(value) 198 else: #probably a string
This works but it is not very portable as it requires to change library code on each installation.
Any suggestions?
I have also tried running it as a stored procedure (with callproc), but in that case it tries to retrieve paramenter information (cmd.Parameters.Refresh). Which it does without error but getting all blanks. So it doesnŽt work either.
Thanks