MS Access query fails on Date/Time field

Louis Luangkesorn lluang at northwestern.edu
Sat Mar 17 00:47:58 EST 2001


This has got to be a FAQ, but I can't find it anywhere

I am trying to use the mx.ODBC.Windows module to query an Access
database (for some data laundering it into a database application we are
using at my church).  But when I try a query that returns a Date/Time
field, it returns an error

>>> import mx.ODBC.Windows
>>> connect =
mx.ODBC.Windows.connect('ptcdonors',user='',password='christ')
>>> c1 = connect.cursor()
>>> c1.execute('select [Receipt #], City, State from Person')
>>> a = c1.fetchone()
>>> a
(3268, None, None)
Works fine, but
>>> c1.execute('select Date, [Receipt #], City, State from Person')
>>> a = c1.fetchone()
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
InternalError: ('S1003', 0, '[Microsoft][ODBC Driver Manager] Program
type out of range', 3013)
>>>
I've narrowed it down to the date field.  When I try to use ADO
(following Hammond's chapter 13) I can get the date object, but then I
have to figure out how to get each of the returned data fields out from
their tuples.

So,
1)  Is it possible to get the information out of an MS Access date field
using ODBC?  -or-
2)  How do you unpack all those tuples that ADO queries return?  I
figured out the date one, using int(aDate), then aDate.Format(), but not
the others.

Thank you.

Louis

--
K Louis Luangkesorn
lluang at northwestern.edu  http://pubweb.nwu.edu/~kll560  PGP:0xF3E2D362

Whatsoever things are true, ... honest, ... just, ... pure, ... lovely,
... of good report; if there be any virtue, and if there be any praise,
think on these things.
     - motto - Northwestern University (Phil 4:8)





More information about the Python-list mailing list