Arrays in Session variables

Results 1 to 2 of 2

Thread: Arrays in Session variables

  1. #1
    mas Guest

    Default Arrays in Session variables

    Can anyone tell me if its possible to set up an ARRAY of Session variables eg. <BR><BR>DIM record(5)<BR>for x=1 to 5<BR>Session("record(x)")<BR>Next<BR><BR>is this possible? Does it have to be done in Global.asa or can it be in the main code?<BR><BR>Thanks for your help!<BR><BR>Mas

  2. #2
    Join Date
    Dec 1969
    Posts
    511

    Default RE: Arrays in Session variables

    Its easy to do, you store the array in the session variable but you can&#039t change or get any of the elements from the array while its in the Session variable, you have to move the array to a local variable first:<BR><BR>Dim MyArray(5)<BR>For x = 1 to 5<BR> MyArray(x) = "hello"<BR>Next<BR>Session("MySession") = MyArray<BR><BR>Dim MyArrayCopy<BR>MyArrayCopy = Session("MySession")<BR>Response.Write MyArrayCopy(1) &#039 Output = "hello"<BR><BR>Hope that helps<BR><BR>Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •