Explicitly closing all ADODB Recordset objects?

Results 1 to 2 of 2

Thread: Explicitly closing all ADODB Recordset objects?

  1. #1
    WonHo Lee Guest

    Default Explicitly closing all ADODB Recordset objects?

    Is there a way to explicitly close and set to nothing all Recordset objects? I have applications that run up to 20 recordset objects and was hoping there was a less mundane way of closeing them.<BR>

  2. #2
    peterjl@austec.net.au Guest

    Default RE: Explicitly closing all ADODB Recordset objects

    I don&#039t tink there is a way of determining how many recordsets are in use and looping through them. You just have to keep track of them.<BR><BR>What I would suggest is that you have a global array to hold your recordset references:<BR><BR>Dim rsAll(20)<BR><BR>You could also have a counter to indicate the highest member that is in use. Then when it came to cleanup your could just loop through the array and close each open recordset that is represented by an array member. Tprevent errors you could also use the IsObject() function determine if a member actually represents an object, and the RecordSet.State property to see if the recordset is open.<BR><BR>However if you have that many rs&#039s open at any time, may I suggest that your table design is not properly optimised, or you maybe should use more join queriesto link related table data together. Also you may do well to see if you really need all those records open together. I.E. Maybe you should be openning individual rs&#039s, grabbing the data into arrays via the GetRows() method, and closing the rs&#039s as soon as you are finished using them. This way you may prevent conflicts due to tables being locked.<BR><BR>It is often very convenient to just open another Rs and leave it open to use at your leisure, but by going to a little more trouble and releasing resources that you don&#039t need, you may avoid performance problems that will occur when your sit gets busy.<BR><BR>

Posting Permissions

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