problem with SQL/login

Results 1 to 5 of 5

Thread: problem with SQL/login

  1. #1
    Adrian Guest

    Default problem with SQL/login

    Below is my code. The problem is that in my code I am calling the "user" as a value in my SQL. but if there is no user by that name it creates an error. <BR>where can i go from here, what are my options?<BR><BR><BR><BR><BR><BR><BR>&#060;%@ Language="VBScript" %&#062;<BR>&#060;!-- #Include virtual="/" --&#062;<BR>&#060;%<BR>user = Request.Form("user")<BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR>MdbFile Path = Server.MapPath("/db/test.mdb")<BR>MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"<BR>SQL_query="SELECT * FROM tbltest WHERE user = &#039;"&user & "&#039;"<BR>Set RSlogin = MyConn.Execute(SQL_query)<BR>%&#062;<BR>&#060;%<BR >If Request.Form ("pass") = RSlogin("pass") then<BR>Response.Redirect ("updateprice.asp")<BR>Else <BR>Response.Redirect ("storelogin.asp?msg=" & Server.URLEncode("Incorrect username and password"))<BR>End if<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: problem with SQL/login

    check recordcount property of the recordset if recordset is empty then response an error

  3. #3
    Adrian Guest

    Default huh?

    sorry, explain more <BR>show me some code please

  4. #4
    Join Date
    Dec 1969

    Default RE: huh?

    TRy this <BR><BR>if Not Rs.EOF Then <BR> &#039;Your code goes here<BR>else<BR> response.write"REcord not found"<BR>end if<BR>

  5. #5
    Join Date
    Dec 1969

    Default Would like to add here...

    ...If you are just checking the user name and password from the table then why select "EVERYTHING", just select username and password from your table.

Posting Permissions

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