session array

Results 1 to 3 of 3

Thread: session array

  1. #1
    chandoo Guest

    Default session array

    Qn:<BR>I have a session array containing 6 elements.<BR>How can I delete the 3rd and 5th item from the session array.<BR><BR>session("elemnts")(1)=100<BR>session ("elemnts")(2)=200<BR>session("elemnts")(3)=300<BR >session("elemnts")(4)=400<BR>session("elemnts")(5 )=500<BR>session("elemnts")(6)=600<BR><BR>After deleting 3rd and 5th items, i should get<BR><BR>session("elemnts")(1)=100<BR>session("e lemnts")(2)=200<BR>session("elemnts")(3)=400<BR>se ssion("elemnts")(4)=600<BR>

  2. #2
    Strauss Guest

    Default RE: session array has articles on arrays, i am sure there is a delete function. then simply reorder your array.<BR><BR>You don&#039t need a weather man to know which way the wind blows.BD

  3. #3
    Join Date
    Dec 1969

    Default No, just VBScript arrays!

    Despite the other person who answered you, there is *NO* delete function for arrays in VBScript that will remove one element and then "slide up" the remaining elements. Period.<BR><BR>If you want one, you have to write it.<BR><BR>Before I go to the trouble to show you how, consider if you *really* need it. If you simply leave an element blank (e.g., do something like <BR>Set array(n) = nothing<BR>then, when you traipse through the array, you could just ignore the blank elements. This could quite possibly be a *lot* more efficient than "sliding" the elements.<BR><BR>Also...<BR><BR>You should *NEVER* access the array elements the way you show:<BR>&nbsp;&nbsp;&nbsp;&nbsp;session("elemnts" )(6)<BR>HORRIBLE performance implications!<BR><BR>Always move the array from the session value to a local array, manipulate the local array, and then move it back to the session value. Saves *oodles* of time!<BR><BR><BR>

Posting Permissions

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