ADO constants
Henrik Weber
Henrik.Weber at sys.aok.de
Fri Dec 6 04:31:16 EST 2002
pdenize at xtra.co.nz (Paul Denize) wrote in message news:<c48654.0212051201.66f95cdc at posting.google.com>...
> I'm having trouble getting the constants in the ADO calls working.
>
> From examples I have found they appear to be comming from
> win32com.client.constants
>
> but when I try I get
>
> C:\>python
> Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import win32com.client
> >>> a=win32com.client.constants.adInteger
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "C:\Python22\lib\site-packages\win32com\client\__init__.py",
> line 131, in __getattr__
> raise AttributeError, a
> AttributeError: adInteger
> >>>
>
>
> Can anyone tell me what I'm doing wrong ?
>
> I have my programs working but had to substitute the constants with
> the
> enumerated values for things like Locking, ClientSide, RecordsetOpen
> ... etc
> All the examples I see have constants drawn from somewhere but I just
> cant find them.
What I usually do is:
ADOconst = win32com.client.gencache.GetModuleForProgID("ADODB.Connection.%s"
% ADOversion).constants
Don't forget to run makepy before you try that.
Then you can access the constants like that:
ADOconst.adInteger
BTW I'm working on a DBI2 module for Access that uses ADO that I hope
to put up on Sourceforge soon.
Cheers
Henrik Weber
More information about the Python-list
mailing list