[thelist] ASP/ADO/SQL: Is it Possible to Store a Recordset in an Application Variable?

Warden, Matt mwarden at odyssey-design.com
Tue May 22 17:51:17 CDT 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi James...

From: "James Aylard" <webmaster at equilon-mrc.com>
Subject: [thelist] ASP/ADO/SQL: Is it Possible to Store a Recordset
in an Application Variable?
>     I have a question that is primarily ASP-oriented, but also
> revolves around ADO and MS SQL: Is it possible to store a recordset
> extracted from a SQL table as an Application variable? Actually,
> I've done that, and on my ASP page I can determine that the
> variable is a recordset using the VBScript TypeName function (the
> result being "Recordset").
>     But I can't figure out how to extract the data from that
> Application variable. (In theory, I'd like to be able to loop
> through the recordset in the Application variable just as I do
> through a recordset grabbed directly from a database -- you know,
> Do While Not objRs.EOF, blah, blah, blah...). Can this be done? If
> so, would someone explain how?

Try this:

set objRecordset = Application("myrecordset")

>     BTW, this is with a small database table that rarely changes,
> so storing it as an Application variable rather than pulling the
> data from the database each time seems like a good idea. Are there
> serious objections to doing this?
>     Thanks.

Not to plug my own article or anything (becuase it could be a lot
better  ;-), but try looking at this:

http://www.evolt.org/article/ASP_Application_level_HTML_Caching/17/621
/index.html

Basically, what I would do (if you can) is create the display of the
data in the recordset and store *that* in an application variable.
Or, spit the recordset into something lighter like an array:

a_myarray  = objMyRecordset.GetRows()
Application.Lock
Application("MyArray") = a_myarray
Application.Unlock

Storing the recordset in the Application object is generally not a
Good Thing(tm) and if you can avoid it, avoid it. ;-)



- --
mattwarden
mattwarden.com

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOwrtiXgH0dUmEhrcEQJe2ACgoDWIxBTmQ/8s3oneJy4GVqQDZzIAn0ij
4R7JjA2W+GOqGa/O8w+phJOH
=Fbql
-----END PGP SIGNATURE-----






More information about the thelist mailing list