ADO example code failed:hlp!

Bill Tutt billtut at microsoft.com
Fri Aug 6 01:11:43 CEST 1999


> From: Hoon Yoon [mailto:hyoon at bigfoot.com]
> 
> 
> Running Christian's code, I get following error message. What 
> am I doing
> wrong? It's same code, but the constants do not contain 
> adModeReadWrite.
> Pls help!
> Thanks much in Adv,
> 
> import win32com.client
> db=win32com.client.Dispatch("ADODB.Connection")
> from win32com.client import constants

In order to access these constants you need to do the following:

adolib = win32com.client.gencache.EnsureModule(
	'{00000200-0000-0010-8000-00AA006D2EA4}', # TypeLib GUID for ADO
	win32con.LANG_NEUTRAL, # LCID
	2, # Major version #
	1, # Minor version #
	win32com.client.genpy.GeneratorProgress()) # Silent progress
indicator.
(The above assumes you have the latest MDAC installed, if you don't plesae
pick up the latest bits from 

Then instead of using win32com.client.Dispatch(), you can now do the
following:
	# Create ADO connection object
	db = adolib.Connection()
	# Create ADO recordset object
	rs = adolib.Recordset()

Bill




More information about the Python-list mailing list