Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Case sensitive comparison


Message #1 by jharvey@i... on Wed, 6 Feb 2002 16:58:19
I am working on a registration ASP application with a MS Access database 

behind it.  Things are fine except for one snag.  The idea is that when 

someone fills out the registration form it drops the data into the 

database and then redirects to a 'thank you' page.  Once someone has 

registered, if they try to register again, the script checks to see if 

their name is in the database and if it is redirects them to a 'you're 

already registered' page.  This all works beautifully IF the name is 

entered EXACTLY the same each time.  Obviously it can't check for Robert 

and Bob and Bobby etc without a lot of coding, but if one time it is 

entered John Smith and the next john smith, I would like it to recognize 

this.  How can this comparison be accomplished.  Now the code snippet that 

does the checking is as follows:



<%

varfname=request.form("fname")

varlname=request.form("lname")



SQL = "SELECT * FROM tblConf"

Set rs=con.Execute(SQL)	

While not rs.eof

	If varfname=rs("fldfName") AND varlname=rs("fldlName")then

	session("conference") = rs("fldConf") 

	response.redirect "registered.asp"

	end if

rs.MoveNext	

wend		

rs.Close

%>



Thanks in advance for any help anyone can provide!
Message #2 by "Peter Rooney" <peter.rooney@p...> on Wed, 6 Feb 2002 17:13:14 -0000
How about using UCase to force both values in uppercase before comparing.





If varfname=UCase(rs("fldfName")) AND varlname=UCase(rs("fldlName"))then





HTH



Peter



-----Original Message-----

From: jharvey@i... [mailto:jharvey@i...]

Sent: Wednesday, February 06, 2002 4:58 PM

To: Access ASP

Subject: [access_asp] Case sensitive comparison







I am working on a registration ASP application with a MS Access database 

behind it.  Things are fine except for one snag.  The idea is that when 

someone fills out the registration form it drops the data into the 

database and then redirects to a 'thank you' page.  Once someone has 

registered, if they try to register again, the script checks to see if 

their name is in the database and if it is redirects them to a 'you're 

already registered' page.  This all works beautifully IF the name is 

entered EXACTLY the same each time.  Obviously it can't check for Robert 

and Bob and Bobby etc without a lot of coding, but if one time it is 

entered John Smith and the next john smith, I would like it to recognize 

this.  How can this comparison be accomplished.  Now the code snippet that 

does the checking is as follows:



<%

varfname=request.form("fname")

varlname=request.form("lname")



SQL = "SELECT * FROM tblConf"

Set rs=con.Execute(SQL)	

While not rs.eof

	If varfname=rs("fldfName") AND varlname=rs("fldlName")then

	session("conference") = rs("fldConf") 

	response.redirect "registered.asp"

	end if

rs.MoveNext	

wend		

rs.Close

%>



Thanks in advance for any help anyone can provide!




-- 

Virus scanned by edNET.

Message #3 by jharvey@i... on Wed, 6 Feb 2002 17:55:47
Thanks, Peter!  I had to add a UCase to the request.form also to make it 

work.

I ended up with this:



varfname=UCase(request.form("fname"))

varlname=UCase(request.form("lname"))



SQL = "SELECT * FROM tblConf"

Set rs=con.Execute(SQL)	

While not rs.eof

	If varfname=UCase(rs("fldfName")) AND varlname=UCase(rs

("fldlName"))then

	session("conference") = rs("fldConf") 

	response.redirect "registered.asp"

	end if

rs.MoveNext	

wend		

rs.Close







> How about using UCase to force both values in uppercase before comparing.

> 

> 

> If varfname=UCase(rs("fldfName")) AND varlname=UCase(rs("fldlName"))then

> 

> 

> HTH

> 

> Peter

> 

> -----Original Message-----

> From: jharvey@i... [mailto:jharvey@i...]

> Sent: Wednesday, February 06, 2002 4:58 PM

> To: Access ASP

> Subject: [access_asp] Case sensitive comparison

> 

> 

> 

> I am working on a registration ASP application with a MS Access database 

> behind it.  Things are fine except for one snag.  The idea is that when 

> someone fills out the registration form it drops the data into the 

> database and then redirects to a 'thank you' page.  Once someone has 

> registered, if they try to register again, the script checks to see if 

> their name is in the database and if it is redirects them to a 'you're 

> already registered' page.  This all works beautifully IF the name is 

> entered EXACTLY the same each time.  Obviously it can't check for Robert 

> and Bob and Bobby etc without a lot of coding, but if one time it is 

> entered John Smith and the next john smith, I would like it to recognize 

> this.  How can this comparison be accomplished.  Now the code snippet 

that 

> does the checking is as follows:

> 

> <%

> varfname=request.form("fname")

> varlname=request.form("lname")

> 

> SQL = "SELECT * FROM tblConf"

> Set rs=con.Execute(SQL)	

> While not rs.eof

> 	If varfname=rs("fldfName") AND varlname=rs("fldlName")then

> 	session("conference") = rs("fldConf") 

> 	response.redirect "registered.asp"

> 	end if

> rs.MoveNext	

> wend		

> rs.Close

> %>

> 

> Thanks in advance for any help anyone can provide!




> -- 

> Virus scanned by edNET.


  Return to Index