[python-win32] Adodbapi date param error with MS access

Adrián Panella adrianpanella at hotmail.com
Tue May 5 03:13:23 CEST 2015


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


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150504/1eea0f59/attachment.html>


More information about the python-win32 mailing list