Click to See Complete Forum and Search --> : How to keep recordset active in session


somjit
10-19-2004, 03:37 AM
Hi,
I am creating an ASP application where the user answers a series of questions distributed across multiple pages. When he starts answering the first page, the records pertaining to his answer must be pulled from the Access database. This can be easily implemented thru an easy connection object in ADO.
For successive pages, I do not want to access the database again, because the recordset from my first page needs to be the source of the next selection (which gets reduced after processing in the second page and so on). How can I implement this, that is, keep the recordset locally or on the server, but active throughout the session? I don't intend to keep the connection to the database open thru all the pages, as Access is a few-connection application.

Also, to this basic implementation, there can be another enhancement required where I need to retain the copy of each recordset created in each page separately.
Need ur valuable suggestion
Somjit

lcscne
10-19-2004, 01:06 PM
dude, I'm not sure if this is what your looking for but check out:

GetRows method (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthgetrows.asp)

you can create your record set and copy the whole thing into an array of whatever scope you want (ie.. local, session, application) then Set RecordSet = Nothing do your processing to the array and when finished recreate the recordset and write the contents of the array back to the db.

Never tried this but seems to me it should work.

somjit
10-19-2004, 03:19 PM
hi lcscne,
Your idea is nice, and I had thought of something like that. But it would be great if I could have a "recordset" sort of object instead of an array, so that I could pass SQL queries to the data.
Let me know if u can suggest something.
Somjit

lcscne
10-19-2004, 05:13 PM
please see:

disconnected recordsets (http://www.devguru.com/features/tutorials/DisconnectedRecordsets/tutDisconnRS.html)

good luck.

ps. I've heard that you should never create a Session or Application scoped recordset. I would venture because of the connection being maintained throughout the length of the session or application, which would be quite resource intensive.

somjit
10-19-2004, 06:18 PM
Thanks again, dude. Thanks a ton.