Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    Question ASP Login case sensitive?

    Hello,
    I've got a login script for my site that check against a mysql db for the login info. but one question, the user name seems to be case sensitive, is there a way to make it so both upper and lower case will work?

    thanks in advance for your time!
    ken

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Code:
    SELECT * FROM users WHERE LOWER(username)='" & LCase(Request.Form("Username")) & "'"
    That query is case-insensitive now. Does that make sense?
    OracleGuy

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    ok,
    so my existing code is:

    SQL = "Select * From accounts"
    Set RS = myconn.Execute(SQL)
    do until RS.eof

    IF user = RS("user") AND pass = RS("pass") Then
    -----

    your code:

    SELECT * FROM users WHERE LOWER(username)='" & LCase(Request.Form("Username")) & "'"


    would it be better for me to run the login right from the select statement?
    or use the loop?

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,964
    Thanks
    0
    Thanked 236 Times in 233 Posts
    As much as possible, filter the records to be retrieved in the SQL statement by using the WHERE clause, not by selecting all the records then filtering them later in your code. That is much faster and more efficient than your method.


  •  

    Posting Permissions

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