[python-win32] Adodbapi date param error with MS access
Vernon D. Cole
vernondcole at gmail.com
Wed May 6 00:25:15 CEST 2015
Thanks for bringing this to attention. That exception was in the code (in
a slightly different form) when I inherited it many years ago. There was
once a note to the effect that it was needed to work around a bug in
Access. It is very likely that the Jet database engine has been improved in
the last decade and the workaround is no longer necessary. Perhaps we can
get rid of it.
What version of the Jet provider are you using?
Do you feel confident that your testing to determine that "this works" was
extensive enough to release the patch generally?
--
Vernon Cole
(adodbapi maintainer)
On Tue, May 5, 2015 at 1:13 AM, Adrián Panella <adrianpanella at hotmail.com>
wrote:
> 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
>
>
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150505/b9a76c86/attachment.html>
More information about the python-win32
mailing list