473,804 Members | 3,822 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 12027

"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
3475
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
1710
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 with static properties for each value I want to store
4
1734
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 and if you do that then how do you pass information for a particular user from one page to another?
1
2004
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 requirement for this screen was that the user could return to this result page at any point from any page...
22
3250
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 servers. The only dubious thing I can see is that it retrieves several arrays from the Application...
2
1767
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 fastest one, just CPU 2.40GHz. So question is as a user am I going to feel a difference in speed...
9
2820
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 required since depending on what was put before determines what pages will be shown after). To store...
3
8465
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 not that easy. In doing some reading and research it seemed that js was more flexible in this...
8
3027
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 session ID is visible, but the session variables and values are not. Can you help me out? Also,...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10320
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7620
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5521
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4299
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
2
3820
muto222
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.