Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: Session Variable Capacity


Message #1 by alangrobert@h... on Tue, 10 Jul 2001 19:40:17
Is it possible to store a recordset object in a session variable and, 

if so, how would you retreive it for additional processing using

VBScript?

Message #2 by Hal Levy <hal.levy@s...> on Wed, 11 Jul 2001 08:14:58 -0400

Can you? Yes.



Option One:

You can create the connection and the recordset in the session. Keeping the

connection open and the recordset open. 

Don't do it. This will cause blocking on connections, slow down performance,

and in general is a very bad idea.



Option Two:

You can create a connection and recordset on the page level- get all the

data and store that into an array in the session object.

Less troublesome than the open connection and recordset. This is still going

to impact performance negatively (especially on a moderately heave volume

site- or more) but is much better than the first option.



Option Three:

Create the connection on each page and re-query the database.

This is an even better option. The connection is pooled so the "spin up

time" on the connection is pretty much non-existent. The dB has cached the

results- so you will get them back quicker.



Option Four:

Create a connection on each page, but this time have your Query in a Stored

Proc and just call that.

Even Better. All the benefits of option three PLUS the SQL is pre-compiled

and pre-optimized by the SQL engine to make things even faster.



Option Five:

Create a COM object that makes your data connection and that calls the

stored procedure and return an array from the COM object.

Now we are cooking with Gas! We have all the benefits of the above- and it's

much easier to get at your data. It lets you re-use the logic on multiple

pages in an efficient way and, if your under MTS or COM+ you get an object

cache to boot!





Notice that the only one I said you absolutely shouldn't do was storing your

Connection and Recordset in the session. This is a VERY bad idea. Any of the

others are "acceptable".



Hal Levy

StarMedia Network, Inc.

Intranet Development Manager 



> -----Original Message-----

> From: alangrobert@h... [mailto:alangrobert@h...]

> Sent: Tuesday, July 10, 2001 3:40 PM

> To: asp_discuss

> Subject: [asp_discuss] Session Variable Capacity

> 

> 

> Is it possible to store a recordset object in a session variable and, 

> if so, how would you retreive it for additional processing using

> VBScript?






  Return to Index