Connection and Recordset Objects

Results 1 to 2 of 2

Thread: Connection and Recordset Objects

  1. #1
    Join Date
    Dec 1969

    Default Connection and Recordset Objects

    Just a general question. I have an asp page that is a booking form (based on the calendar project in Teach Yourself Active Server Pages 3.0 in 21 Days). First I connect to the database and check that there is nothing booked on a particular date. If there is nothing booked on that date the recordset returned is empty (objRS.EOF) so I can now book that day using objRS.AddNew. If I submit to the same asp page I have to re create the connection and recordset. I would have thought that because I didn't close them in the previous code, I could still use them to add the new records. Why is this?

  2. #2
    Join Date
    Dec 1969

    Default You answered your own question...

    &#062; If I submit to the same asp page <BR><BR>That&#039;s your answer. Each ASP page is 100% independent. When the page finishes processing, *ALL* objects created in that particular page are closed and all the memory used by them is released back (so it can be reused as needed).<BR><BR>[This is an exception to this: Objects that are stored in Session or Application variables "persist" so long as the variable remains active. That&#039;s the good news. The bad news is that one of *THE WORST* things you can do, from a DB performance perspective, is persist connections and recordsets in this way. In short NEVER NEVER DO IT.]<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