Hi,
I'm having trouble with some ASP script.
Here it is:
<%
fname=request.form("name"
email1=request.form("email1"
country=request.form("country"
company=request.form("company"
Set dbconnection = Server.CreateObject("ADODB.Connection"
dbconnection.open "DSN=fdatabase"
Set RS_Users = Server.CreateObject("ADODB.Recordset"
RS_Users.ActiveConnection = dbconnection
RS_Users.Source = "ftable"
RS_Users.CursorType = 1
RS_Users.CursorLocation = 2
RS_Users.LockType = 2
RS_Users.Source = "fdatabase"
SQL_Users = "Select * from ftable"
RS_Users.Open SQL_Users
Do while not RS_Users.eof
If RS_Users("email" = email1 then
response.redirect("existinguser.htm"
else
RS_Users.AddNew
RS_Users("name" = name
RS_Users("email" = email1
RS_Users("country" = country
RS_Users("company" = company
RS_Users.Update
End If
RS_Users.movenext
loop
RS_Users.close
Set RS_Users=Nothing
dbconnection.close
%>
The script works if email1 is not in the database, but if an email address is typed that is in the database it still adds it as a new record.
Any help would be greatly appreciated.
--Tim
I'm having trouble with some ASP script.
Here it is:
<%
fname=request.form("name"
email1=request.form("email1"
country=request.form("country"
company=request.form("company"
Set dbconnection = Server.CreateObject("ADODB.Connection"
dbconnection.open "DSN=fdatabase"
Set RS_Users = Server.CreateObject("ADODB.Recordset"
RS_Users.ActiveConnection = dbconnection
RS_Users.Source = "ftable"
RS_Users.CursorType = 1
RS_Users.CursorLocation = 2
RS_Users.LockType = 2
RS_Users.Source = "fdatabase"
SQL_Users = "Select * from ftable"
RS_Users.Open SQL_Users
Do while not RS_Users.eof
If RS_Users("email" = email1 then
response.redirect("existinguser.htm"
else
RS_Users.AddNew
RS_Users("name" = name
RS_Users("email" = email1
RS_Users("country" = country
RS_Users("company" = company
RS_Users.Update
End If
RS_Users.movenext
loop
RS_Users.close
Set RS_Users=Nothing
dbconnection.close
%>
The script works if email1 is not in the database, but if an email address is typed that is in the database it still adds it as a new record.
Any help would be greatly appreciated.
--Tim