Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declaring and using a Session Array- PLEASE HELP!

Status
Not open for further replies.

IBACFII

Programmer
Sep 2, 2004
76
US
I need to know how to decare a session array. I need it to be session level. Where Do i put all of this? I was thinking the globax.asax. But I dont know where to start. I am going to use it to hold information from the current session and previous postbacks so that I can create my own "back" button. BTW I am using ONLY one asp page and onPostBack I am sending these session vars back to the server via USPs'

Thanks in advance!

IBACFII
 
Opps forgot to mention it needs to be an array of a structured Var containing some variables that are going to store the session vars. ie first session has 5 session vars with data they get written into the array then some stuff happens posts back and there are now 8 vars with data to be written into the array well i guess i need to first figure out the declaration and then i will need some more help.


IBACFII
 
You can declare a session variable from any page in your project or you could, as you say, do this in the global file.

For example, on any page you can simply set the session variable to hold the array by using:

Code:
Session.Add("MySessionArray", MyArray)

You can then access this session array by referering Session("MySessionArray").

Hope this helps.


----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Very cool thanks. Any way to redim it after I manipulate it??


IBACFII
 
Oops For got to mention that it is an array of a structure
IE
Code:
Structure BackHistory
     Dim strRptId as String
     Dim strLOB as String
     Dim strRegion as String
     Dim strSpec as String
     Dim strProvID as String
End Structure

Public arrhistory(9) as BackHistory

Then From your exmaple i can dim it to the session
Code:
Session.Add("sesHistory", MyArray)
What is the MyArray???


Thanks.

IBACFII
 
MyArray was just a sample array that I created to show you how to add it to a session level variable. In your case you would change it to add your arrhistory array.

As an alternative to using arrays you should aslo check out the Collection Object as it will do the same thing you are trying to do but is much simpler to manipulate.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top