case sensitive

J

Jeff

i have this on my signup page
Set rs = Conn.Execute("SELECT * from rounds")

DO WHILE NOT rs.EOF

IF request.form("username") = rs.fields.item("username").value THEN

response.redirect("register2.asp")

END IF

rs.MoveNext
LOOP

the problem is.. some who signed up as say Jeff can still sign up as jeff
or jeFF how can i fix this??
Jeff
 
D

Dave Anderson

Jeff said:
the problem is.. some who signed up as say Jeff can
still sign up as jeff or jeFF how can i fix this??

Are you asking how to require case sensitivity or how to eliminate it?



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
J

Jeff

How to eliminate it... as is.. I could sign up as Jeff.. and it wouldne stop
me from signing up as jeff or jefF i want Jeff to be blocked in any case
form
Jeff
 
B

Bob Barrows [MVP]

Jeff said:
i have this on my signup page
Set rs = Conn.Execute("SELECT * from rounds")

DO WHILE NOT rs.EOF

IF request.form("username") = rs.fields.item("username").value THEN

response.redirect("register2.asp")

END IF

rs.MoveNext
LOOP

the problem is.. some who signed up as say Jeff can still sign up
as jeff or jeFF how can i fix this??
Jeff


The best way is to allow your database to do the filtering (assuming your
database is sql server or jet, which are both case insensitive by default).
Why in the world are you returning all the rows from your table with all the
fields simply to determine if a record containing "jeff" exists? OK, so you
probably don't realize that there is a more efficient way to do it ...

sql="select count(*) from rounds where [username]='" & _
replace(request.form("username"),"'","''") & "'"
set rs=conn.execute(sql,,1)
if rs(0) > 0 then
'user exists
else
'user does not exist
end if


Bob Barrows
 
B

Bob Barrows [MVP]

Oh! I see, you want it to be case sensitive? If "Jeff" exists. you want it
to reject "jeff"?

That's a lot harder, especially if your db is Access. It's time to tell us
what database type and version you are using.

Bob Barrows
 
J

Jeff

well... ummm yes.. it is access :( and yes.. you are correct, i want it to
reject any form of jeff
Jeff
 
J

Jeff

And not sure what you mean by what version. The access is with Office 2002
if that is what you mean.
 
L

Lord Merlin

| And not sure what you mean by what version. The access is with Office 2002
| if that is what you mean.
|
|
| | > Oh! I see, you want it to be case sensitive? If "Jeff" exists. you want
it
| > to reject "jeff"?
| >
| > That's a lot harder, especially if your db is Access. It's time to tell
us
| > what database type and version you are using.
| >
| > Bob Barrows
| >
| > Jeff wrote:
| > > How to eliminate it... as is.. I could sign up as Jeff.. and it
| > > wouldne stop me from signing up as jeff or jefF i want Jeff to be
| > > blocked in any case form
| > > Jeff
| > >
| > >
| > > | > >> "Jeff" wrote:
| > >>>
| > >>> the problem is.. some who signed up as say Jeff can
| > >>> still sign up as jeff or jeFF how can i fix this??
| > >>
| > >> Are you asking how to require case sensitivity or how to eliminate
| > >> it?
| > >>
| > --
| > Microsoft MVP - ASP/ASP.NET
| > Please reply to the newsgroup. This email account is my spam trap so I
| > don't check it very often. If you must reply off-line, then remove the
| > "NO SPAM"
| >
| >
|
|

Well, you could always instead do this in ASP, thus making it more robust
and more flexible:



DO WHILE NOT rs.EOF


username = UCASE(rs.fields.item("username").value)

IF UCASE(request.form("username")) = username THEN

response.redirect("register2.asp")

END IF

rs.MoveNext
LOOP



--


Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
 
J

Jeff

Ok.. so that would set the username to all uppercase... then check against
it... got ya..
thanks
 
B

Bob Barrows [MVP]

Yes, that is what I meant.

You should be able to utilize the strconv() function to perform a case
sensitive query. It will prevent the use of an index on the username field
so performance will suffer.

Select count(*) from rounds
where strcomp([username],
replace(request.form("username"),"'","''"),0) = 0

HTH,
Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top