calling query from memory?

H

Hermes

Hi All,

Is there a way of performing an sql query and then call it again from memory
rather than having to execute the query again?
As We have a few pages which gets data from a long query but then depending
on user interaction could get recalled several times but with the data still
the same.

Kind regards,
Hermes
 
B

Bob Barrows [MVP]

Hermes said:
Hi All,

Is there a way of performing an sql query and then call it again from
memory rather than having to execute the query again?
As We have a few pages which gets data from a long query but then
depending on user interaction could get recalled several times but
with the data still the same.

Kind regards,
Hermes
You can store your data in a session variable by using Getrows to convert
your recordset to an array and setting the array to a session variable. Like
this:

dim arData
'open your recordset, then
if not rs.eof then arData = rs.GetRows
rs.close:set rs=nothing
'close and destroy your connection here as well
if isArray(arData) then
Session("data") = arData
else
Session("data") = "no data"
end if


Then, in a subsequent page:

dim arData
arData = Session("data")
if isArray(arData) then
'work with the data in the array.
end if

Search for the keyword GetRows at www.aspfaq.com to see some examples of
working with the data in a GetRows array.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,078
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top