程序自动运行了两遍而产生的问题呀。很急。谢谢!
大家好,请大家帮帮忙看一下,下面的程序,为什么我用没有注册过的注册时会弹出“此用户名已存在,请重新输入”,而打开数据库里一看,刚才的注册数据上传到了数据库里了。是不是,注册时,程序自动运行了两遍而产生的问题呀。很急。谢谢!
<%
username=request.form("username")
userpassword=request.form("userpassword")
userpassword2=request.form("userpassword2")
userfullname=request.form("userfullname")
usersexual=request.form("usersexual")
usercompany=request.form("usercompany")
usertel=request.form("usertel")
userfax=request.form("userfax")
useremail=request.form("useremail")
userhome=request.form("userhome")
useradress=request.form("useradress")
userzipcode=request.form("userzipcode")
userproblem=request.form("userproblem")
useranswer=request.form("useranswer")
userdate=request.form("userdate")
set rs=server.createobject("adodb.recordset")
sql="select * from wbcompanyuser where username='"&username&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.write "<script language='javascript'>alert('此用户名已存在,请重新输入!');history.back();</script>"
else
rs.addnew
rs("username")=username
rs("userpassword")=userpassword
rs("userpassword2")=userpassword2
rs("userfullname")=userfullname
rs("usersexual")=usersexual
rs("usercompany")=usercompany
rs("usertel")=usertel
rs("userfax")=userfax
rs("useremail")=useremail
rs("userhome")=userhome
rs("useradress")=useradress
rs("userzipcode")=userzipcode
rs("userproblem")=userproblem
rs("useranswer")=useranswer
rs("userdate")=userdate
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>