If you mention a VBScript Class well I'll suppose so

returning recordset can be dangerous, but is very convenient - just retun it

Set funcname = rst

But take a look if the db connection used for it will be alive after
returning it.
This could mean you need to keep the object of this class in memory - not
setting its variable to Nothing if you are opening the connection in its
constructor
and closing in the destructor Class_Terminate. Just be careful nothing more.

The arrays - sometimes this is better. At least it is independent of any
connections
and the object live frame. By default nothing special is required. For
example this will
work:

Class C
    Function A
        Dim x(1)
        x(0) = "asdad"
        x(1) = "sddsfgjhdfkj"
        A = x
    End Function
End Class
Set cc = New C
Dim b
b = cc.A
Set cc = Nothing
For I = LBound(b) to UBound(b)
    Response.Write b(I)
Next

Unless I am not mistyping something of course ;).

If you got the array from GetRows - ok no problem again - the array is
copied
into a new variant if you return it thus do not wory about its life time -
it will live longer
than the poor object reduced to Nothing  oh, sorry I am a little crazy
today.


-----Original Message-----
From: Daniel Field [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 13, 2002 6:07 PM
To: ActiveServerPages
Subject: OT: VB/VBScript COM


Hi All,

How do I return either a recordset or better still an array from a function
within a Class?

Thanks,

Dan



_____________________________________________________________________
This e-mail has been scanned for viruses by the WorldCom Internet Managed
Scanning Service - powered by MessageLabs. For further information visit
http://www.worldcom.com

---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to