Session variables and database

Results 1 to 3 of 3

Thread: Session variables and database

  1. #1
    Greg T Guest

    Default Session variables and database

    Can someone help me with setting variables?<BR><BR>I have a database with these fields. <BR>ID<BR>User_Name<BR>Password<BR>company<BR><BR> I&#039m trying to set session veriables at the end of the code based on the information in the database. When I call it from another page, All it responds with is the User_Name. Please help.<BR><BR><BR>Here is the code.<BR><BR><BR>&#060;%<BR> Set Cm = Server.CreateObject("ADODB.Command")<BR> Cm.ActiveConnection = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:homedomainmdbmy.mdb"<BR><BR> Cm.CommandText = "SELECT * FROM Accounts WHERE " & _<BR> "User_Name=&#039" & Request.Form("User_Name") & "&#039 AND " & _<BR> "Password=&#039" & Request.Form("Password") & "&#039 "<BR><BR>Cm.CommandType = 1<BR>Set Rs = Cm.Execute<BR><BR> If Rs.EOF Then<BR> Session("Authenticated") = 0<BR> Response.Redirect ("login.asp")<BR> Else<BR> Session("user_name") = Request.form("user_name")<BR> Session("id") = Request.form("id")<BR> Session("company") = Request.form("company")<BR> Response.Redirect ("welcome.asp")<BR> End If<BR><BR> %&#062;

  2. #2
    Ed Guest

    Default RE: Session variables and database

    It looks like you mean to have:<BR><BR>Session("id") = Rs("id")<BR>Session("company") = Rs("company")<BR><BR>I would wager that the id and company values are from the database, not from the FORM entered by the user.

  3. #3
    Greg T Guest

    Default RE: Session variables and database

    Thank you! you were on the money!

Posting Permissions

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