ActivePython ASP comobject.getCOMObject() does not work

Jim jim at publishingresources.com
Fri Jul 20 11:54:22 EDT 2001


Mark Hammond <MarkH at ActiveState.com> wrote in
<3B576D8C.9080705 at ActiveState.com>: 

>Jochen Riekhof wrote:
>
>> 
>> rst = getRecordset()
>> 
>> Now, I want to use the recordset:
>> rst.MoveFirst()
>> 
>> and get the following error:
>> Python ActiveX Scripting Engine (0x80020009)
>> Traceback (innermost last): File "<Script Block >", line 5, in ?
>> rst.MoveFirst() AttributeError: 'tuple' object has no attribute
>> 'MoveFirst' /OrboPCT/pytest.asp, Zeile 15
>> rst.MoveFirst()
>
>
>This means that "getRecordset()" is actually returning _2_ values - the 
>recordset itself, and some other value (possibly a boolean or some
>such). 
>
>You will probably find that you need something like:
>
>ok, rst = getRecordset()
>
>or maybe the other way around:
>
>rst, ignored = getRecordset()
>
>Mark.
>

>From the Python-Win32 list:


Jim Abrams wrote:

>objCN = Server.CreateObject("ADODB.Connection")
>objCN.open(dsn)
>objRS = objCN.Execute("select * etc")
>objRS now has a tuple of (<RecordSetObject>, int)
>I have no idea what the int means, but you need to trim it away to get
>at the RecordSet object.
>
Ok, well I obviously didn't know that Application wasn't just a simple 
Dispatch object in asps but this one I do know! The reason Execute 
returns a tuple is because Execute has an [out] parameter which returns 
the number of rows affected. Here's the clip from OLEVIEW:

 _Recordset* Execute(
                        [in] BSTR CommandText,
                        [out, optional] VARIANT* RecordsAffected,
                        [in, optional, defaultvalue(-1)] long Options);

Any COM [out] parameter will be returned from the method since in Python 
parameters are passed by value rather than by reference (we won't talk 
about object references).

--
Jens B. Jorgensen
jens.jorgensen at tallan.com



More information about the Python-list mailing list