473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 11955

"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.