Connection Problem

Results 1 to 3 of 3

Thread: Connection Problem

  1. #1
    Join Date
    Dec 1969

    Default Connection Problem

    Can someone tell me what in the heck is wrong with the syntax in the following code? It is taking a username and password from the previous page and using those to query an access database to see if they exist. If it does it gives them access to the page they want, if not is ends them to the notvalidated page.<BR>Thanks.<BR><BR>&#060;%<BR>&#039;Read in the password and username from the form<BR>Dim strUserName, strPassword<BR>strUserName = Request.form("txtName")<BR>strPassword = Request.form("txtPassword")<BR><BR>Set Conn = Server.CreateObject("ADODB.Connection")<BR> <BR>Set RS = Server.CreateObject("ADODB.RecordSet")<BR> <BR>Conn.Open "nor360.nlf","sa",""<BR><BR>RS.Open "SELECT * FROM Valid WHERE username = " & _<BR> strUserName & " AND password = " & _<BR> strPassword"", MyConn, adOpenDynamic, adLockPessimistic, adCMDText<BR><BR><BR><BR>&#039;If the recordset is not empty, the user is validated<BR>If Not rs.EOF Then<BR> &#039;We need to set bolAuthenticated as True!<BR> Session("bolAuthenticated") = True<BR><BR> &#039;Send the user to the URL they came from<BR> Response.Redirect Request.form("URL")<BR>Else<BR> &#039;The user was not validated...<BR> &#039;Take them to a page which tells them they were not validated...<BR> Response.Redirect "notvalidated.asp<BR>End If<BR><BR>%&#062;

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default A LOT is wrong

    try this<BR><BR>RS.Open "SELECT * FROM Valid WHERE username = &#039;" & _<BR>strUserName & "&#039; AND password = &#039;" & _<BR>strPassword & "&#039;",

  3. #3
    Join Date
    Dec 1969

    Default RE: A LOT is wrong

    Also, your connection object is called conn, not MyConn!<BR><BR>HTH<BR>Dave<BR>

Posting Permissions

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