学雷锋日志愿者活动:无法验证用户已经存在(asp代码)

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 01:22:37
<%
username= trim(request.form("username") )
password= trim(request.form("password1"))
realname=trim(request.form("realname"))
sex=trim(request.form("sex"))
email=trim(request.form("email"))
tishi=trim(request.form("tishi"))
daan=trim(request.form("daan1"))
bzhu=trim(request.form("bzhu"))
set conn=createobject("adodb.connection")
set rs=createobject("adodb.recordset")
w=server.MapPath("Connections/wangjingui/13237059329/wang.mdb")
conn.open "provider=microsoft.jet.oledb.4.0;data source="&w
sql1="SELECT * from user1 where 用户名='"&username&"'"
rs.open sql1,conn,1,1
response.Write "<div>"&rs.eof&"</div>"
response.Write "<div>"&rs.bof&"</div>"
response.write rs.recordcount
if rs.recordcount<>0then
response.Write "该用户已经存在<a href=zhuce.html>返回 </a>"
end if
if rs.recordcount=0 then
rs.close()
set rs=nothing
conn.close
set conn=nothing
set conn=createobject("adodb.connection")
set rs=createobject("adodb.recordset")
w=server.MapPath("Connections/wangjingui/13237059329/wang.mdb")
conn.open "provider=microsoft.jet.oledb.4.0;data source="&w
rs.open "user1",conn,3,2
rs.addnew
rs("用户名")=username
rs("密码")=password
if realname<>"" then
rs("真实姓名")=realname
end if
if sex<>"" then
rs("性别")=sex
end if
if email<>"" then
rs("邮箱")=email
end if
if tishi<>"" then
rs("密码提示问题")=tishi
end if
if daan<>"" then
rs("密码提示问题的答案")=daan
end if
if bzhu<>"" then
rs("备注")=bzhu
end if
rs.update
if err then
response.write("保存出错<a href=zhuce.html>返回")
else
response.write("保存成功<a href=index.asp>返回登陆")
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

if rs.recordcount<>0 then
response.Write "该用户已经存在<a href=zhuce.html>返回 </a>"
end if