...

View Full Version : ASP Login case sensitive?



angst
05-03-2004, 01:02 AM
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

oracleguy
05-03-2004, 04:30 AM
SELECT * FROM users WHERE LOWER(username)='" & LCase(Request.Form("Username")) & "'"

That query is case-insensitive now. Does that make sense?

angst
05-03-2004, 05:40 AM
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?

glenngv
05-03-2004, 07:54 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum