i have made a script that gets the values from a form and adds it to a database but what i now want to do is add a check so if the value is already in the data base it will say Username is already in use please select another so if for instence some one fills out the username as tom and another person then trys to use tom as a username it will say that the username is already in use here is my process code
<%
' declare variables
Dim UserName
Dim Password
Dim Email
' get posted data into variables
UserName = Trim(Request.Form("UserName"))
Password = Trim(Request.Form("Password"))
Email = Trim(Request.Form("Email"))
' validation
Dim validationOK
validationOK=true
If (Trim(UserName)="") Then validationOK=false
If (Trim(Password)="") Then validationOK=false
If (Trim(Email)="") Then validationOK=false
IF (Trim(UserName)="EOF" or Trim(Password)="EOF" or Trim(Email)="EOF") Then validationOK=false & response.write("If you have entered <strong>EOF</strong> in any of the fields then.<br>")
If (validationOK=false) Then
Response.write("Please go back fill in all ")
Response.write("the requied information<br>")
Response.write("<a href=""signup.
asp"">Click here</a> to return to the form.")
ELSE
'Add account to Database
Dim sConnection, objConn , objRS , strSQL
sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=xxxx; UID=xxxx;PASSWORD=xxxx; OPTION=3"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(sConnection)
Set objRS = objConn.Execute("INSERT INTO accounts (user,password,email ) VALUES ('" & username & "','" & password & "','" & email & "')")
'Response.Redirect("index.
asp")
Response.write("<h2>Account Added!</h2>")
Response.write("Account: " & UserName & "<BR>")
Response.write("Password: " & Password & "<BR>")
Response.write("Email: " & Email)
END IF
%>
that form makes sure the vales from the form are not blank but i want it to check there not blank and the values dont already exist in the database.. any one help me