When to destroy ADODB.Recordset Object

Results 1 to 3 of 3

Thread: When to destroy ADODB.Recordset Object

  1. #1
    Matiur Rahman Guest

    Default When to destroy ADODB.Recordset Object

    How a function returns an Object? Is it byval or byref?<BR>Where should I destroy the recordset object? Is it in Main() or in GetRs()?<BR>Please refer to the following example:<BR>&#060;%<BR>Sub Main()<BR> dim rs<BR> Set rs=GetRs()<BR>end Sub<BR>&#039;*********************<BR> Function GetRS()<BR> dim Con<BR> dim RsRec<BR>--Create Con and RsRec Objects using Server.CreateObject<BR>--Open Connection and Open recordset object<BR> <BR>Set GetRS=RsRec<BR><BR>End function<BR><BR><BR><BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: When to destroy ADODB.Recordset Object

    not sure but i would expect it to be ByRef<BR><BR>you destroy the recordset object as soon as you are through with it. What i do for realy large recordsets is put the data into an array and destroy it immediately..smaller ones i would destroy immediately after i populate all the records

  3. #3
    Matiur Rahman Guest

    Default RE: When to destroy ADODB.Recordset Object

    Thanks for your reply.<BR>But I still little confused. I don&#039;t get RS if I destroy the object in the function being called (byref). So, I can&#039;t destroy RS in the function. I can&#039;t use a recordset in sub main() returned by the function GetRs() if I close the recordset object in the GetRS() function.<BR><BR>So, I think, object is returned byref and you can&#039;t destroy it in the function being called.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts