|
|
|
|
|
| | |
|
Active Server Pages ASP programs help tutorial tutorials routine routines jobs listserve mailinglist bulletin board bulletin boards programming snippet snippets CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Re: Defining an Array as Global or Applicatio Data? |
From: |
Tim |
Date: |
6/14/1999 2:47:41 PM |
IP: |
|
Heres some sample code that shows how to use session and
application variables to pass entire arrays around
as "global" variables:
Dim YourArray(50)
For Index = 0 To 50
YourArray(Index) = Index
Next
Session("YourArray") = YourArray
Application("YourArray") = YourArray
YourSessionArray = Session("YourArray")
YourApplicationArray = Application("YourArray")
For Index = 0 To 50
Response.Write("YourSessionArray(" & Index & ") = " & YourSessionArray(Index) & "<br>")
Next
Response.Write("<br>")
For Index = 0 To 50
Response.Write("YourApplicationArray(" & Index & ") = " & YourApplicationArray(Index) & "<br>")
Next
Just be sure to grab your array when you enter a page that will be using it. For example:
YourArray = Session("YourArray")
YourArray(0) = "whatever"
YourArray(1) = "whatever"
etc.
Then whenever you make changes to the array you have to reset the session (or "global")
variable in order for it to pass to other pages. For example:
YourArray(0) = "whatever"
YourArray(1) = "whatever"
Session("YourArray") = YourArray
Keep in mind though that session variables need cookies enabled to work and they tend to
consume server resources. |
Previous Message
|
|

|
|
|
|
|
|
|
|
|
|