question about COM and ADO

Bill Tutt billtut at microsoft.com
Tue Feb 1 15:10:57 EST 2000


> -----Original Message-----
> From: gtalvola at NameConnector.com [mailto:gtalvola at NameConnector.com]
> 
[problems with translating the below VB code into Python]
> > >     Dim cnn as New ADODB.Connection
> > >     cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
> > Source=c:\db1.mdb"
> > >     dim rs as New ADODB.Recordset
> > >     rs.CursorLocation = constants.adUseClient
> > >     rs.Open "SELECT * FROM Table1", cnn, adOpenStatic,
> > > adLockBatchOptimistic
> > >     set rs.ActiveConnection = Nothing

Well according to build.py:
		# This is not the best solution, but I dont think there is
		# one without specific "set" syntax.
		# If there is a single PUT or PUTREF, it will function as a
property.
		# If there are both, then the PUT remains a property, and
the PUTREF
		# gets transformed into a function.
		# (in vb, PUT=="obj=other_obj", PUTREF="set obj=other_obj
So, something like the following might work since, ActiveConnection does
have a put and a putref functions:
rs.SetActiveConnection(None) 

This code in Python
rs.ActiveConnection = None 
Has the bogus VB equivalent of:
rs.ActiveConnection = Nothing 
(i.e. no Set)

The PUT vs. PUTREF distinction royally sucks.

Bill




More information about the Python-list mailing list