Ok

With this code below what do I have to add to the code so I can check the userID in the Database to the strUserID and make sure there are no DUPLICATE UserID already in the DataBase?


Please help...this is the last area I need finished!

<!-- #INCLUDE FILE="data.asp" -->
<% Response.Buffer = true %>
<%
'-- Check if Submit button pushed, if not ignore the entire script
If Request.Form("btnAdd") = "Submit" Then

'-- Make sure all boxes have data entered into them
If Request.Form("name") <> "" OR Request.Form("password") <> "" OR _
Request.Form("password2") <> "" OR _
Request.Form("email") <> "" OR _
Request.Form("userID") <> "" Then

'-- Make sure the passwords match
If Request.Form("password") = Request.Form("password2") Then

'-- Declare your variables
Dim DataConnection, cmdDC, RecordSet, SQL, strError
Dim strUserName, strPassword, strEmail, strUserID

'-- Get data from the form fields
strUserName = Request.Form("name")
strPassword = Request.Form("password")
strEmail = Request.Form("email")
strUserID = Request.Form("userID")


'-- Create object and open database
Set DataConnection = Server.CreateObject("ADODB.Connection")
DataConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & DatabasePath & ";"


Set cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = DataConnection

'-- default SQL
SQL = "SELECT * FROM UserRegistration"

If Request.Form("name") <> "" Then
SQL = "SELECT * FROM Register WHERE " & _
"Register.userID='" & strUserID & "' AND " & _
"Register.password ='" & strPassword & _
"' OR Register.email ='" & strEmail & "'"
End If

cmdDC.CommandText = SQL
Set RecordSet = Server.CreateObject("ADODB.Recordset")

'-- Cursor Type, Lock Type

'-- ForwardOnly 0 - ReadOnly 1
'-- KeySet 1 - Pessimistic 2
'-- Dynamic 2 - Optimistic 3
'-- Static 3 - BatchOptimistic 4


RecordSet.Open cmdDC, , 0, 2

'-- check to see if the user and password or
' e-mail address have registered before
If Not RecordSet.EOF Then
If RecordSet.fields("email")=strEmail Then
Response.Redirect "emailerror.asp"
Else
Response.Redirect "userpassworderror.asp"
End If

Else
'-- Add new record to the database
Dim Dconn, sSQL
Set Dconn = Server.CreateObject("ADODB.Connection")
Dconn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & _
DatabasePath & ";"

sSQL = "INSERT INTO Register(name, email, userID, " & _
"password, userLevel) VALUES ('" & strUserName & _
"','" & strEmail & "','" & strUserID & _
"','" & strPassword & "',1)"
Dconn.Execute sSQL
Dconn.Close
Set Dconn = Nothing


'Forward the user to page to notify of authentication
Response.Redirect "thankyou.asp"
End If
Else
Response.Redirect "passworderror.asp"
End If

'-- Close all connections
' RecordSet.Close
Set RecordSet = Nothing


' DataConnection.Close
Set DataConnection = Nothing


Else
'Tell them what they entered wrong
strError = "Please fill in all the boxes"
End If
End If


%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>

</body>

</html>