下面程序中的问题是:我两个次输入相同的用户名称和Email 及网址 ,却不提示“失败,已有注册!”为什么不能检测数据库中的记录有相同内容的提示报错,这个程序到底哪里出错?请高手指点。
注:welcome.asp是注册成功的提示。
<%
username = request("username")
Email = request("TxtEmail")
homepage = request("TxtHomepage")
Set conn = Server.CreateObject("ADODB.Connection")
Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
DBPath = "Data Source=" & Server.MapPath( "../wz.mdb" )
conn.Open Provider & DBPath
sql = "select * from addnew where username='"&username&"' or E_mail='"&Email&"' or homepage='"&homepage&"'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 2, 2
'response.write username & "
"
'response.write Email & "
"
'response.write homepage & "
"
'response.write request("leibie") & "
"
'response.write cstr(now()) & "
"
'response.end
if rs.eof then
rs.addnew
rs("username") = username
rs("E_mail") = Email
rs("homepage") = homepage
rs("leibie") = request("leibie")
rs("time") = cstr(now())
rs.update
response.redirect "welcome.asp"
end if
response.write "失败,已有注册!"
response.end
%>