Problem using ASP Session variable
am 03.02.2005 12:09:03 von Mike
Hi all,
I have a problem using session variables.
I have two asp page A.asp and B.asp
In page A.asp I wrote this code:
Set Session(rsSession) = rsExistLog
where rsExistLog is a recordset that is the result of an SQL selection query
and rsSession is the name of the session variable in which I want to store
the recordset.
Then, in page B.asp I wrote
if Session(rsSess) is Nothing then
'Do something
else
'Read the recordset data
dim x
x = Session(rsSess)(0)
end if
but I have an error when I try to retrieve the value of the first field of
the recordset.
I have verified that after the first assignement in page A.asp the recordset
is valid and contains the right data ( Session(rsSess)(0) gives the expected
value), but when I try to read it in the other page along the same ASP
Session I do not succeed.
Any help is appreciated.
Best regards,
Mike.
Re: Problem using ASP Session variable
am 03.02.2005 12:42:56 von reb01501
Mike wrote:
> Hi all,
> I have a problem using session variables.
>
> I have two asp page A.asp and B.asp
> In page A.asp I wrote this code:
>
> Set Session(rsSession) = rsExistLog
DON'T DO THIS!!!
ADO objects are not free-threaded.
http://www.aspfaq.com/2053
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Re: Problem using ASP Session variable
am 03.02.2005 20:30:04 von Mark Schupp
See Bob's comment.
Also see http://www.aspfaq.com/show.asp?id=2157 about why session variables
may get lost
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Mike" wrote in message
news:0CB7DEE8-BE73-4288-9170-F7F01EC65626@microsoft.com...
> Hi all,
> I have a problem using session variables.
>
> I have two asp page A.asp and B.asp
> In page A.asp I wrote this code:
>
> Set Session(rsSession) = rsExistLog
>
> where rsExistLog is a recordset that is the result of an SQL selection
query
> and rsSession is the name of the session variable in which I want to store
> the recordset.
>
> Then, in page B.asp I wrote
>
> if Session(rsSess) is Nothing then
> 'Do something
> else
> 'Read the recordset data
> dim x
> x = Session(rsSess)(0)
> end if
>
> but I have an error when I try to retrieve the value of the first field of
> the recordset.
> I have verified that after the first assignement in page A.asp the
recordset
> is valid and contains the right data ( Session(rsSess)(0) gives the
expected
> value), but when I try to read it in the other page along the same ASP
> Session I do not succeed.
> Any help is appreciated.
>
> Best regards,
> Mike.