Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: How to throw a recordset into application object


Message #1 by "Samuel Fullman" <sam@c...> on Sun, 18 Nov 2001 01:50:15
Hi All,



I use Macromedia's Ultradev to create database connections and recordsets 

from the database.



Recently I have been concerned with cutting down on database access time 

for recordsets (products, for example) that don't change much from day to 

day.  I would like to throw the entire collection into an application 

variable, but it's not working.  I know you can put arrays into 

application variables, but is there a trick here?  This is not working.



Here is the code that Macromedia generates to access the recordset:

<%

set RSProd = Server.CreateObject("ADODB.Recordset")

RSProd.ActiveConnection = "driver={Microsoft Access Driver (*.mdb)}; 

DBQ=f:\users\sample\www\databases\sample.mdb"

RSProd.Source = "SELECT BusinessName, FirstName, LastName, PrimaryEmail, 

Password FROM EmailList order by BusinessName ASC, LastName ASC"

RSProd.CursorType = 0

RSProd.CursorLocation = 2

RSProd.LockType = 3

%>



Next I try to throw the Object "RSProd" into appliation variable:

<%

application(durableRecordset) = RSProd '(This is line 22 in the script.)

%>



The error message I get is as follows:



Application object error 'ASP 0102 : 80004005' 



Expecting string input 



/training/application_var_02.asp, line 22 



The function expects a string as input. 

Message #2 by "Ken Schaefer" <ken@a...> on Mon, 19 Nov 2001 11:15:51 +1100
<%

If not objRS.EOF then

    arrResults = objRS.getRows

End if



If isArray(arrResults) then

    Application("arrResults") = arrResults

Else

    Response.Write("we have no results")

End If

%>



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Samuel Fullman" <sam@c...>

Subject: [access_asp] How to throw a recordset into application object





: Hi All,

:

: I use Macromedia's Ultradev to create database connections and recordsets

: from the database.

:

: Recently I have been concerned with cutting down on database access time

: for recordsets (products, for example) that don't change much from day to

: day.  I would like to throw the entire collection into an application

: variable, but it's not working.  I know you can put arrays into

: application variables, but is there a trick here?  This is not working.

:



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index