473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

session variables and arrays

I want to store a bunch of textstrings (about 500) returned from a database
query in a session array. I've googled all over the net, not to find any
working method.

Is there anybody who has the ultimative, definite working method as to how
you transfer a "local" array to a session array and later transfer the
session array to a "local" array.

regards
Henning
Jul 22 '05 #1
4 11959

"please-answer-here" <no***@nohost.nodomain.invalid> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
I want to store a bunch of textstrings (about 500) returned from a database
query in a session array. I've googled all over the net, not to find any
working method.

Is there anybody who has the ultimative, definite working method as to how
you transfer a "local" array to a session array and later transfer the
session array to a "local" array.
Simply assign it.

Dim MyArray(500, 10)
Session("MyArray") = MyArray

The only caveat is that you must assign it from the session to a local
variable before attempting to reference any of it's elements

Dim MyArray, ele
MyArray = Session("MyArray")
ele = MyArray(1, 1)

You cannot reference elements in the session object directly:

Dim ele
ele = Session("MyArray")(1, 1) ' does NOT work
-Mark

regards
Henning

Jul 22 '05 #2
Mark J. McGinty wrote:
"please-answer-here" <no***@nohost.nodomain.invalid> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
I want to store a bunch of textstrings (about 500) returned from a
database query in a session array. I've googled all over the net,
not to find any working method.

Is there anybody who has the ultimative, definite working method as
to how you transfer a "local" array to a session array and later
transfer the session array to a "local" array.
Simply assign it.

Dim MyArray(500, 10)
Session("MyArray") = MyArray

The only caveat is that you must assign it from the session to a local
variable before attempting to reference any of it's elements

Dim MyArray, ele
MyArray = Session("MyArray")
ele = MyArray(1, 1)

You cannot reference elements in the session object directly:

Dim ele
ele = Session("MyArray")(1, 1) ' does NOT work


Yes that was exactly what I found out, but in my case it didn't work (got
all sorts of errormessages type mismatch / index out of range) Will take a
closer look at my own code

thanks for the assistance !

-Mark

regards
Henning

Jul 22 '05 #3
Also use the following functions since variables are Empty by default

If IsEmpty(myvar) Then....

or
If IsArray(myvar) Then
Redim blah(20)
Session("myvar") = blah
End If

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

"please-answer-here" <no***@nohost.nodomain.invalid> wrote in message
news:42***********************@dreader2.cybercity. dk...
Mark J. McGinty wrote:
"please-answer-here" <no***@nohost.nodomain.invalid> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
I want to store a bunch of textstrings (about 500) returned from a
database query in a session array. I've googled all over the net,
not to find any working method.

Is there anybody who has the ultimative, definite working method as
to how you transfer a "local" array to a session array and later
transfer the session array to a "local" array.


Simply assign it.

Dim MyArray(500, 10)
Session("MyArray") = MyArray

The only caveat is that you must assign it from the session to a local
variable before attempting to reference any of it's elements

Dim MyArray, ele
MyArray = Session("MyArray")
ele = MyArray(1, 1)

You cannot reference elements in the session object directly:

Dim ele
ele = Session("MyArray")(1, 1) ' does NOT work


Yes that was exactly what I found out, but in my case it didn't work (got
all sorts of errormessages type mismatch / index out of range) Will take a
closer look at my own code

thanks for the assistance !


-Mark

regards
Henning



Jul 22 '05 #4
And here's a good link which includes information about session arrays
which are often used by shopping carts:

Session Object
http://msdn.microsoft.com/library/de.../en-us/iissdk/
iis/ref_vbom_seso.asp

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item)...
2
by: adam | last post by:
Having spent nearly 2 years in win forms land the inevitable request came for me to "do some web pages". So being new to this bit of .net and having had a look around I can't see where the best...
4
by: Andy Kasotia | last post by:
I have read couple of articles warning against the use of storing VB COM objects (Apartment Threading) in Session Variables due to the fact that these variables could go bad. My question is...
1
by: Larry Neylon | last post by:
Hi, I'm working on a VBScript application on IIS6 and I'm looking for some advice about the best way of replacing or improving session variable usage. The application is in a secure extranet...
22
by: roadrunner | last post by:
Hi, Our website has recently been experiencing some problems under load. We have pinpointed a particular function which slows dramatically when we have these problems. Normally it should execute...
2
by: Michaelk | last post by:
Can somebody tell me how many Session variables would be considered exessive, and when they start really affect the server speed. For example on 20-30 asp pages I need to use about 200-300 session...
9
by: cendrizzi | last post by:
Hi all, I've read some stuff on this but can't seem to come up with a solution that works right. I have a semi-mature (yet very large and robust) internal web application that currently only...
3
by: sjsean | last post by:
All thanks in advance for reading my post. I am new to using js and more accustomed to vbscript. I had written code which created a shopping cart into an array using vbscript and then...
8
by: Eddie | last post by:
I am having difficulty in setting variables in a session, and then accessing those variables throughout the web pages that they click on. After having them set a user name and password,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.