180 Session memvar..?

K

Kent Johnson

Hi all,

I would like to create 180 session variables.
I can do this with:

Session("1")= 1
Session("2")= 2
....
Session("180")= 180

...but would't it be possible to create something like:

For x=1 to 180
Session(" & x & ")= x
next

How should I write the correct syntax?

/Kent J.
 
J

Jurjen de Groot

In my opinion you can just do

For x = 1 To 180
Session(x.ToString) = x
Next

kind regards,

Jurjen de Groot
G.I.T.S., Netherlands.
 
K

Kent Johnson

Great! Thanks!

Jurjen de Groot said:
In my opinion you can just do

For x = 1 To 180
Session(x.ToString) = x
Next

kind regards,

Jurjen de Groot
G.I.T.S., Netherlands.
 
A

Alvin Bruney

A better approach would be to create an array of 180 variables and cache the
array. It's more efficient that way and uses less memory as the CLR can
optimize the array storage, but cannot with session variables.

Regards
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top