Having trouble saving array in Session object 
Author Message
 Having trouble saving array in Session object

I am trying to save an array of values to a session
variable and retrieve it in another ASP page. When I do
this, I get a type mismatch error, even though the VarType
function returns '8204' for both the Session variable and
the local array name.
Code fragments:
First page:
Dim Ipart()
Redim Ipart(5)
Session("savedipart") = Ipart

Second page:
Dim Ipart()
Redim Ipart(5)
Ipart = Session("savedipart")<---gives type mismatch error.

Am I doing something stupid, or is this not possible?
I began by following the example on p. 333
of "Professional Active Server Pages 2.0" by Fedorov,
et.al., pub by Wrox Press.



Tue, 02 Mar 2004 00:22:08 GMT  
 Having trouble saving array in Session object
First page:
Dim Ipart()
Redim Ipart(5)
Session("savedipart") = Ipart

Second page:
Dim Ipart     '<=== as an ordinary variant, not an array...
Ipart = Session("savedipart")

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> I am trying to save an array of values to a session
> variable and retrieve it in another ASP page. When I do
> this, I get a type mismatch error, even though the VarType
> function returns '8204' for both the Session variable and
> the local array name.
> Code fragments:
> First page:
> Dim Ipart()
> Redim Ipart(5)
> Session("savedipart") = Ipart

> Second page:
> Dim Ipart()
> Redim Ipart(5)
> Ipart = Session("savedipart")<---gives type mismatch error.

> Am I doing something stupid, or is this not possible?
> I began by following the example on p. 333
> of "Professional Active Server Pages 2.0" by Fedorov,
> et.al., pub by Wrox Press.



Tue, 02 Mar 2004 02:46:25 GMT  
 Having trouble saving array in Session object
I have a similar situation.  Once you've assigned a session var = the array,
how can you response.write the elements of the array to see what you've got?
I've tried response.write session("sessionvar(0)"), but never see a value.
Is this not the correct syntax?  I've used:

 response.write ubound(sessionvar)

 . . .  to make sure it has values, and it's display a value, the number of
extents, which I've verified is correct.  Why is it I can't do the same with
the value of the extents?

Regards -



Quote:
> First page:
> Dim Ipart()
> Redim Ipart(5)
> Session("savedipart") = Ipart

> Second page:
> Dim Ipart     '<=== as an ordinary variant, not an array...
> Ipart = Session("savedipart")

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --



> > I am trying to save an array of values to a session
> > variable and retrieve it in another ASP page. When I do
> > this, I get a type mismatch error, even though the VarType
> > function returns '8204' for both the Session variable and
> > the local array name.
> > Code fragments:
> > First page:
> > Dim Ipart()
> > Redim Ipart(5)
> > Session("savedipart") = Ipart

> > Second page:
> > Dim Ipart()
> > Redim Ipart(5)
> > Ipart = Session("savedipart")<---gives type mismatch error.

> > Am I doing something stupid, or is this not possible?
> > I began by following the example on p. 333
> > of "Professional Active Server Pages 2.0" by Fedorov,
> > et.al., pub by Wrox Press.



Tue, 02 Mar 2004 05:16:17 GMT  
 Having trouble saving array in Session object
response.write session("sessionvar")(0)

or better...

myArray =  session("sessionvar")
response.write myArray(0)

--

Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> I have a similar situation.  Once you've assigned a session var = the array,
> how can you response.write the elements of the array to see what you've got?
> I've tried response.write session("sessionvar(0)"), but never see a value.
> Is this not the correct syntax?  I've used:

>  response.write ubound(sessionvar)

>  . . .  to make sure it has values, and it's display a value, the number of
> extents, which I've verified is correct.  Why is it I can't do the same with
> the value of the extents?

> Regards -



> > First page:
> > Dim Ipart()
> > Redim Ipart(5)
> > Session("savedipart") = Ipart

> > Second page:
> > Dim Ipart     '<=== as an ordinary variant, not an array...
> > Ipart = Session("savedipart")

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

> > Please do not email questions - post them to the newsgroup instead.
> > --



> > > I am trying to save an array of values to a session
> > > variable and retrieve it in another ASP page. When I do
> > > this, I get a type mismatch error, even though the VarType
> > > function returns '8204' for both the Session variable and
> > > the local array name.
> > > Code fragments:
> > > First page:
> > > Dim Ipart()
> > > Redim Ipart(5)
> > > Session("savedipart") = Ipart

> > > Second page:
> > > Dim Ipart()
> > > Redim Ipart(5)
> > > Ipart = Session("savedipart")<---gives type mismatch error.

> > > Am I doing something stupid, or is this not possible?
> > > I began by following the example on p. 333
> > > of "Professional Active Server Pages 2.0" by Fedorov,
> > > et.al., pub by Wrox Press.



Tue, 02 Mar 2004 07:39:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Save array in Session object

2. Save array in Session object

3. Save array in Session object

4. Having Trouble populating an array from table values

5. Having trouble sending multiple emails using outlook object

6. Newbie having trouble with Object Error

7. Having trouble copying an object

8. Having trouble passing object to a sub procedure

9. Saving Objects in Session variables

10. having trouble with syntax

11. newbie: having trouble with uniprint/gsview

12. Having trouble learning how to call stored procedures.

 

 
Powered by phpBB® Forum Software