Login | |
|
 |
Storing an array in a Session variable - 6/13/2001 12:06:55 AM
|
|
 |
|
| |
peach24
Posts: 7
Score: 0
Joined: 6/9/2001
From: USA
Status: offline
|
This code I put in my GLOBAL.ASA file (It is executed, I've checked) : '-------------------------------------- Sub Session_OnStart Dim Cart_Content() ReDim Cart_Content(1,3) Cart_Content(0,1) = "Init" Cart_Content(0,2) = "Init" Cart_Content(0,3) = "Init" Session("Sess_Cart_Content") = Cart_Content End Sub '-------------------------------------- Then in my asp page I use this code : '-------------------------------------- Dim Cart_Content(), Add_Item Cart_Content = Session("Sess_Cart_Content") Add_Item = UBound(Cart_Content,1) + 1 ReDim Preserve Cart_Content(Add_Item,3) Cart_Content(Add_Item,1) = Article Cart_Content(Add_Item,2) = Entry Cart_Content(Add_Item,3) = Size Session("Cart_Content") = Cart_Content End Sub '-------------------------------------- Considering the ASP manuals and samples I've checked it should work, but I always get a 'Type Mismatch' error in the line 'Cart_Content=Session("Sess_Cart_Content")' Can anyone help me out ? jac-the-man (Visitor) Feb 6, 2001 Don't Dim Cart_Content in the asp page. Let asp/vbscript type the variable from a variant to an array. Use a second variable as the dynamic array and load it up with the contents of Cart_Content and then re-dim as necessary. Cart_Content will act as a "go-between" variable. Also, keep in mind that an array of variants is not the same as a variant array!
|
|
| |
|
|
|
|
|