VBScript Class conn & rs

Results 1 to 3 of 3

Thread: VBScript Class conn & rs

  1. #1
    ePimp Guest

    Default VBScript Class conn & rs

    Hi. In my VBScript class, I have a function that returns a recordset (ADO connection object only, no ADO recordset object created):<BR><BR> Set rs = conn.Execute(sql)<BR> Set functionname = rs<BR> Set rs = Nothing<BR><BR>Although I can set rs to nothing in the function and close the connection in the class terminate event, if I "rs.close" in my function after "Set functionname", the reference to the recordset in the calling .asp page is lost; there are no records, no object.<BR><BR>Is it necessary to explicitly close the recordset or the variable that refers to it at anytime? Is either the class terminate event or the referring variable going out of focus sufficient to close the recordset? I set all class objects to nothing at the end of each page in which they are instantiated. Thanks for any help.

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

    Default RE: VBScript Class conn & rs

    &#062;Set functionname = rs<BR><BR>change this to Set functionname = rs.getrows<BR><BR>then functionname will be an array and this will have the data<BR><BR>if you want to "clone" this recordset then<BR><BR>Set functionname = rs.clone<BR><BR><BR>

  3. #3
    ePimp Guest

    Default RE: VBScript Class conn & rs

    Thanks for the reponse. Since not many records are returned (sometimes only one) per connection, but many concurrent connections can potentially exist, I purposely avoided creating an ADO recordset object to minimize application overhead. As such, those methods aren&#039t available, nor are they necessary.<BR><BR>I guess I want to know if closing a connection or setting an object instance to nothing is sufficient to free any resources occupied by the variable that refers to the records.

Posting Permissions

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