Arrays or Rs in Sessions : Help me plz

J

John

Hi all,

I've got an issue with session variables in asp pages. I need to make a
decision that I think you can hopefully help me out here.

When a session starts on the iss server I need to store some information in
some session variables. But this information is coming from an old dbase
system. In the beginning of this project it was just a simple static array
of information. Afterwards it turns out that this must be a dynamic array
that we could change in other asp pages.

Now, at this moment, it is even worse! There are several dynamic arrays
(max10) with a lot of records (max100) and intensive changing of data in
those arrays, sorting it and so on.

The big problem is that I cannot write the changes in those dbases in a
direct way and request them back. I know, it would help me a lot. Don't ask
why! Ask this question to the green project manager!

When the user is logging out then all changes will be save as an xml-file on
the server, and some queuing service is picking this up a minute later to
control all the data and do finally some dbase changes.

My question is: can I change the arrays into disconnected record sets and
store them into session variables? I'm using NT2K server with II6. In the
old days (nt4 IIS4) they always said that storing objects into session
variables are a bad way of programming for IIS. But in this case and with
II6???

Some comments would be nice!

Thanks in adv.
Best regards,
John
 
R

Ray at

My question is: can I change the arrays into disconnected record sets and
store them into session variables?

Yes. The quick way is to use the .GetRows() method of the recordsetup
object to convert a recordset into a two dimenionsal array. Either that, or
just store the data that you need in arrays you build yourself. You don't
want to store objects in session variables.
(http://www.aspfaq.com/show.asp?id=2053)


I'm using NT2K server with II6.

NT2K? he he he...

If you're using Windows 2000 Server, you're using IIS5. IIS6 is on Windows
Server 2003 only.


In the
old days (nt4 IIS4) they always said that storing objects into session
variables are a bad way of programming for IIS. But in this case and with
II6???

Still true!

If I were you, I'd go kick the project manager's rear.

Ray at work
 
J

John

Hoi Ray@work :)

Actually I'm receiving the data in an xml format and must convert it into a
recordset, then save it in an array using GetRows + redim the array to add
some more fields to it for internal usage.

Finally store the array into a session object.

The following page will fetch the array in the session object and convert it
back to a connectionless recordset, doing some stuff with it (sort, add,
change data, delete data,.) and the last step will be convert it back to an
array and store it back into the session object. This will be done for
several arrays on several pages :(

:) indeed, its win2K with IIS5


I do remember Mr. Charles Carroll say something long ago about this issue,
but was wondering that ms-people solved this issue in some way or another.

Why do you think he's green! His balls are disabling him to breathe ;)

Do I really have to do all this work :( damn!

Thanks Ray!
John.
 
B

Bob Barrows [MVP]

John said:
Hoi Ray@work :)

Actually I'm receiving the data in an xml format and must convert it
into a recordset, then save it in an array using GetRows + redim the
array to add some more fields to it for internal usage.

Finally store the array into a session object.

The following page will fetch the array in the session object and
convert it back to a connectionless recordset, doing some stuff with
it (sort, add, change data, delete data,.)

Why not work with the array? What is the purpose of creating a recordset
object here? I assume you are talking about creating an ad hoc array, adding
fields to the Fields collection via the Append method and putting the data
from the stored array into it. Why go through this trouble when you can more
efficiently work with the array? It's not like you are going to be able to
connect the ad hoc recordset to the data source and persist the changes
you've made.

Instead of the array, you might want to consider using an xml document,
which will be a little easier to work with than the array.
and the last step will be
convert it back to an array and store it back into the session
object. This will be done for several arrays on several pages :(


:) indeed, its win2K with IIS5



I do remember Mr. Charles Carroll say something long ago about this
issue, but was wondering that ms-people solved this issue in some way
or another.

No. Especially if Access is involved. There is a way to make ADO objects
free-threaded (and therefore capable of being stored in Session), but this
should be avoided if Access is being used on the server, because Jet is
single-threaded.

If Access is not involved, you can make a registry change to cause ADO
objects to be free-threaded, using a batch file that is installed by MDAC in
the ...\project files\common files\system\ado folder called makfre12.bat.
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
473,708
Messages
2,569,347
Members
44,654
Latest member
7Jhamal74

Latest Threads

Top