473,545 Members | 1,662 Online
Bytes | Software Development & Data Engineering Community
+ 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 11983

"please-answer-here" <no***@nohost.n odomain.invalid > wrote in message
news:ep******** ******@TK2MSFTN GP14.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("MyArra y") = 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("MyArra y")
ele = MyArray(1, 1)

You cannot reference elements in the session object directly:

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

regards
Henning

Jul 22 '05 #2
Mark J. McGinty wrote:
"please-answer-here" <no***@nohost.n odomain.invalid > wrote in message
news:ep******** ******@TK2MSFTN GP14.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("MyArra y") = 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("MyArra y")
ele = MyArray(1, 1)

You cannot reference elements in the session object directly:

Dim ele
ele = Session("MyArra y")(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.n odomain.invalid > wrote in message
news:42******** *************** @dreader2.cyber city.dk...
Mark J. McGinty wrote:
"please-answer-here" <no***@nohost.n odomain.invalid > wrote in message
news:ep******** ******@TK2MSFTN GP14.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("MyArra y") = 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("MyArra y")
ele = MyArray(1, 1)

You cannot reference elements in the session object directly:

Dim ele
ele = Session("MyArra y")(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.a sp

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
3458
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) Case "Authenticated" Case "CI_CODE" Case "organisation_description" Case "location_description"
2
1688
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 way to store session data. 1) use the (string)Session approach Obviously bad for maintenance, readability etc. 2) have a typed MySession object...
4
1726
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 what's the workaround this? I have also read about making ASP Stateless...I'm guessing that means turning the session and application variables off...
1
1970
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 environment. Currently the application has a search customers page with 10 search fields which list the results below the search fields. The...
22
3195
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 in under a second but it rises to about one minute under duress. The code is fairly straight forward with no calls to databases or any other...
2
1745
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 variables and 5 arrays by 1000 elements 50 characters long each. Let say having 300 users using those pages at the same time. Server is not the...
9
2799
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 works with one window open at a time. Maybe I'm abusing the use of $_SESSION but I have data entry processes split up in several steps (which is...
3
8451
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 transferred the information into a session variable. However what I didn't know was that deleting/manipulating information in an array using vbscript was...
8
3018
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, successfully authenticating against Active Directory, I send them from the login.php page to the index.php page. But when I get to the index.php page, the...
0
7393
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7653
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1871
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 we have to send another system
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.