Session variable and

Results 1 to 6 of 6

Thread: Session variable and

  1. #1
    Svetlana Guest

    Default Session variable and

    Hello!<BR>There is a very strange situation! I work on logging user on site. When he is logged on there is a button to logout.<BR>When I logon user I save some values from the query to Session variables<BR>Session("u_id") = RS.fields("u_id");<BR>Session("u_name") = RS.fields("u_name");<BR><BR>and show button Logoff!<BR><BR>Response.Write("&#060;p&#062;&#060; h4&#062;Welcome "+Session("u_name")+"!&#060;/h4&#062;&#060;/p&#062;");<BR>Response.Write("&#060;form method=&#039post&#039&#062;");<BR>Response.Write(" &#060;input type=&#039submit&#039 name=&#039action&#039 value=&#039logoff&#039&#062;");<BR>Response.Write( "&#060;/FORM&#062;")<BR><BR>Method post send all to this page again and I want to check Session variables at the beginning like<BR>Response.Write(Session("u_name"));<BR>I&#0 39ve got a mistake : "ADODB.Field: object is no longer valid"<BR>Why? Is there a connection between my Session variables and ADODB.Field? and what can I do?<BR><BR>Thanks ahead

  2. #2
    Join Date
    Dec 1969
    Posts
    1,435

    Default RE: Session variable and

    You need to change the code to refer to the field values rather than the field objects themselves, like this:<BR><BR>Session("u_id") = RS.fields("u_id").value;<BR>Session("u_name") = RS.fields("u_name").value;<BR><BR>Dunc<BR><BR>

  3. #3
    Svetlana Guest

    Default It doesn't help! I don't know what to do

    I need that Session variable badly for recognizing if user logged or not. It seems that after pressing button Logoff that variable just disappeared. <BR>And even if my user logged on and I type in Explorer name of asp-page which at first checks my Session variable I get the same error.

  4. #4
    Join Date
    Dec 1969
    Posts
    850

    Default RE: Session variable and

    Are you sure that you didn&#039t use<BR><BR>set Session("u_id") = RS.fields("u_id")<BR>set Session("u_name") = RS.fields("u_name")<BR><BR>?? (notice the additional word SET)


  5. #5
    Svetlana Guest

    Default Syntax is correct. Where is the problem?

    I use JavaScript and when I do <BR>Response.Write(Session("u_id"));<BR><BR>afte r Session("u_id") = RS.fields("u_id").value;<BR>in my page I see the right value and everything is OK.<BR> <BR>But when I press button (type submit) "Logoff" something happens with this variable during Post method of form (I suppose) and when I try to read it in the beginning of the page I&#039ve got that mistake about ADODB.Field.<BR>

  6. #6
    Svetlana Guest

    Default Problem is solved :)))

    Thanks to everybody!!! I forgot to close connection to Database

Posting Permissions

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