Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Cant get a unique username system set up...


Message #1 by "Brad" <insuran@m...> on Fri, 19 May 2000 22:54:2
I guess i am a moron becuz i can get this damn thing step up right... I 

have got replys saying i should set up a system of procederes but i have 

elected to go with the simplier suggestion.  This is the code i am working 

with.. I get no errors when i run the page.. But it does not work.. I can 

enter the same username over and ovger and it doesnt catch it..  here is my 

code i dont understand why it doesnt work but it doesnt.  The form works 

great... If you want to check it out for yourself got to 

www.motorbrain.com/jatohighlands/handicap.asp



<% dim strusername, strpassword, stremail

strusername = request.form("username1")

strpassword = request.form("password")

stremail = request.form("email")

%>

<%

Dim connstring, my_conn, strSQL

connstring = "DRIVER={SQL 

Server};SERVER=SQLDATA;LANGUAGE=us_english;DATABASE=****;UID=****;PWD=****"

set my_conn=server.createObject("adodb.connection")

my_Conn.Open ConnString 

strSQL = "Select * from handicap where username = '& strusername &' "

set rs = my_conn.Execute (strSQL)

if rs.recordcount > 0 then 

response.write "USERNAME "& strusername &" TAKEN"

else

response.write "USERNAME "& strusername &"  NOT TAKEN"

end if %>

Message #2 by "madhu_m m" <mmadhu_m@h...> on Sat, 20 May 2000 05:50:20 GMT
instead of checking the recordcount property check for EOF and BOF.

It would work!



Madhu





>From: "Brad" 

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Cant get a unique username system set up...

>Date: Fri, 19 May 2000 22:54:2

>

>I guess i am a moron becuz i can get this damn thing step up right... I

>have got replys saying i should set up a system of procederes but i have

>elected to go with the simplier suggestion.  This is the code i am working

>with.. I get no errors when i run the page.. But it does not work.. I can

>enter the same username over and ovger and it doesnt catch it..  here is my

>code i dont understand why it doesnt work but it doesnt.  The form works

>great... If you want to check it out for yourself got to

>www.motorbrain.com/jatohighlands/handicap.asp

>

><% dim strusername, strpassword, stremail

>strusername = request.form("username1")

>strpassword = request.form("password")

>stremail = request.form("email")

>%>

><%

>Dim connstring, my_conn, strSQL

>connstring = "DRIVER={SQL

>Server};SERVER=SQLDATA;LANGUAGE=us_english;DATABASE=****;UID=****;PWD=****"

>set my_conn=server.createObject("adodb.connection")

>my_Conn.Open ConnString

>strSQL = "Select * from handicap where username = '& strusername &' "

>set rs = my_conn.Execute (strSQL)

>if rs.recordcount > 0 then

>response.write "USERNAME "& strusername &" TAKEN"

>else

>response.write "USERNAME "& strusername &"  NOT TAKEN"

>end if %>

Message #3 by "Ken Schaefer" <ken.s@a...> on Sat, 20 May 2000 14:30:35 +1000
Do this:



Response.write(strSQL)



and the answer will be staring you in the face :-) (you are missing some "

marks in your SQL statement...)



Cheers

Ken





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

From: "Brad" <insuran@m...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, May 19, 2000 10:00 PM

Subject: [asp_databases] Cant get a unique username system set up...





> I guess i am a moron becuz i can get this damn thing step up right... I

> have got replys saying i should set up a system of procederes but i have

> elected to go with the simplier suggestion.  This is the code i am working

> with.. I get no errors when i run the page.. But it does not work.. I can

> enter the same username over and ovger and it doesnt catch it..  here is

my

> code i dont understand why it doesnt work but it doesnt.  The form works

> great... If you want to check it out for yourself got to

> www.motorbrain.com/jatohighlands/handicap.asp

>

> <% dim strusername, strpassword, stremail

> strusername = request.form("username1")

> strpassword = request.form("password")

> stremail = request.form("email")

> %>

> <%

> Dim connstring, my_conn, strSQL

> connstring = "DRIVER={SQL

>

Server};SERVER=SQLDATA;LANGUAGE=us_english;DATABASE=****;UID=****;PWD=****"

> set my_conn=server.createObject("adodb.connection")

> my_Conn.Open ConnString

> strSQL = "Select * from handicap where username = '& strusername &' "

> set rs = my_conn.Execute (strSQL)

> if rs.recordcount > 0 then

> response.write "USERNAME "& strusername &" TAKEN"

> else

> response.write "USERNAME "& strusername &"  NOT TAKEN"

> end if %>

>





Message #4 by "Robert Larsson" <robert.l@m...> on Sat, 20 May 2000 10:09:50 +0200
Hi there, I'm sorry to say that I haven't followed your questions.



But one thing, instead of recordcount > 0 use rs.EOF like bellow.



if rs.EOF THEN

  Response.Write ("Username Taken")

else

  Response.Write ("Username Not Taken")

end if



I can Imagine that this is the problem.

Have you debuged to see what value you're getting out of recordcount ?, if

not do it.



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

From: "Brad" 

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, May 19, 2000 10:00 PM

Subject: [asp_databases] Cant get a unique username system set up...





> I guess i am a moron becuz i can get this damn thing step up right... I

> have got replys saying i should set up a system of procederes but i have

> elected to go with the simplier suggestion.  This is the code i am working

> with.. I get no errors when i run the page.. But it does not work.. I can

> enter the same username over and ovger and it doesnt catch it..  here is

my

> code i dont understand why it doesnt work but it doesnt.  The form works

> great... If you want to check it out for yourself got to

> www.motorbrain.com/jatohighlands/handicap.asp

>

> <% dim strusername, strpassword, stremail

> strusername = request.form("username1")

> strpassword = request.form("password")

> stremail = request.form("email")

> %>

> <%

> Dim connstring, my_conn, strSQL

> connstring = "DRIVER={SQL

>

Server};SERVER=SQLDATA;LANGUAGE=us_english;DATABASE=****;UID=****;PWD=****"

> set my_conn=server.createObject("adodb.connection")

> my_Conn.Open ConnString

> strSQL = "Select * from handicap where username = '& strusername &' "

> set rs = my_conn.Execute (strSQL)

> if rs.recordcount > 0 then

> response.write "USERNAME "& strusername &" TAKEN"

> else

> response.write "USERNAME "& strusername &"  NOT TAKEN"

> end if %>

>

Message #5 by "Didik A. Hartono" <didik@u...> on Mon, 22 May 2000 14:40:35 +0700
I Think it's a query problem.. may be you can try this query...



strSQL = "Select * from handicap where username like '" & strusername & "%'"



when you execute this query.. the execution will find the closest match of

username you typed..

but it can only be work if you search by the "first name" of the query,

example :

if I have two record in handicap table like this :

#1  UserID : JS

     Username : John Smith

#2 USerID : SJ

     UserName : Smith John

#3 UserID : JM

     UserName : John Maquire



and the variable 'strusername' in your asp code is 'John', then after

execution you will get the result record #1 and record #3 as the closest

match of the criteria.

I hope this will help you, thank's.











Message #6 by =?iso-8859-1?Q?=C1rni_B=2E_Halld=F3rsson?= <abh@t...> on Mon, 22 May 2000 10:56:36 -0000
I would use the if statement



if (rs.eof) and (rs.bof) then

  Username does not exist

else

  Username exist

end if



RecordCount does need dynamic cursor



Arni Halldorsson

  abh@t...



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

From: Didik A. Hartono 

Sent: 22. ma=ED 2000 07:41

To: ASP Databases

Subject: [asp_databases] Re: Cant get a unique username system set 

up...





I Think it's a query problem.. may be you can try this query...



strSQL =3D "Select * from handicap where username like '" & strusername 

& "%'"



when you execute this query.. the execution will find the closest match 

of

username you typed..

but it can only be work if you search by the "first name" of the query,

example :

if I have two record in handicap table like this :

#1  UserID : JS

     Username : John Smith

#2 USerID : SJ

     UserName : Smith John

#3 UserID : JM

     UserName : John Maquire



and the variable 'strusername' in your asp code is 'John', then after

execution you will get the result record #1 and record #3 as the 

closest

match of the criteria.

I hope this will help you, thank's.








  Return to Index