Using clr.Reference[int] should work if ra is an in-out (VT_BYREF) parameter. 
Note that not many OleAut APIs use VT_BYREF. Jscript does not support in-out 
parameters and the API would not be usable form Jscript.

We do have the option of returning a tuple with the recordset and the number of 
records, just like pywin32, by checking the ITypeInfo if any of the parameters 
are VT_BYREF. We even had this working at some point. However, we have decided 
not to use ITypeInfo to check the type of parameters in order to keep the code 
paths the same when there is no typelib available.

If you run into lots of APIs with in-out parameters, do let us know. Its 
something we could revisit for IPy 2.1. I will collect a list of such APIs in 
the "Known Issues" section in my blog at 
http://blogs.msdn.com/shrib/archive/2008/07/30/idispatch-support-on-in-ironpython-beta-4.aspx
 for tracking purposes.

Using clr.Reference will always work now and in the future, with or without 
typelibs being available.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
Sent: Wednesday, August 27, 2008 1:10 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Return value for ADODB .Execute() call?

On Wed, Aug 27, 2008 at 12:17 PM, Vernon Cole <[EMAIL PROTECTED]> wrote:
>
> We can't pass the "ra" parameter in python, so pywin32 returns a tuple with
> the recordset and the number of records.
>
> How do I retrieve the number of records (for a non-row-returning query) in
> Iron?

Presumably, Execute expects you to pass a VT_I4 | VT_BYREF so that it
can store the value in the reference.  If this were for a CLR API,
you'd pass an int reference by using a variable of type
clr.Reference[int](). I don't know that this will work for COM, but I
assume that it would:

ra = clr.Reference[int]()
self.cmd.Execute(ra)
recordCount = ra.Value

--
Curt Hagenlocher
[EMAIL PROTECTED]
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to