Please help me with this!!

Results 1 to 3 of 3

Thread: Please help me with this!!

  1. #1
    krishna Guest

    Default Please help me with this!!

    Hi,<BR> I&#039ve a user registration form which accepts the user name and password also to be stored in an access database. The user name is the primary key in the table of database. If I try to give same user name to another record, I get an error from the access database. I want this to be done by my code and prompt the user to enter another user name.<BR> <BR>Could you please help me with this coding..<BR> <BR>krishna<BR>

  2. #2
    Scott S Guest

    Default RE: Please help me with this!!

    I&#039m not sure how efficient it is, but what you could do is to first check & see if there already is a username like that. so the query would be something like SELECT * FROM USERS WHERE USERNAME = @WHATUSERENTERED if any records are returned you know that that name has already been taken. If it hasnt been taken then enter it into the database if so return an error. If you can use SQL Server, you could write most of this into an Stored Procedure, and then return different values based on success or failure. <BR><BR>Scott S<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Please help me with this!!

    Poor man&#039s code:<BR>&#060;%<BR>uName=request.form("Username") <BR>pwd=request.form("password")<BR><BR>sql1="sele ct Username form myTable where UserName=&#039"&Uname&"&#039"<BR><BR>sql2="Insert Into myTable (Username,Password)"& _<BR>"Values (&#039"&uname&"&#039,&#039"&password&"&#039)"<BR>< BR>set conn=server.createobject("adodb.connection")<BR>co connString<BR><BR>Set Rs=conn.execute(sql1)<BR>If Not (Rs.BOF And Rs.EOF) Then<BR>response.write "Username: "&uName&" has been taken..."<BR>rs.close<BR>set rs=nothing<BR>conn.close<BR>set conn=nothing<BR>response.end<BR>End If<BR><BR>conn.execute(sql2) <BR>conn.close<BR>set conn=nothing<BR>%&#062;<BR><BR>This code will work for ur Access DB<BR><BR>jw<BR><BR><BR>

Posting Permissions

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