<%
if session("pass")<>"rt" then
response.Write("<script language='javascript'>alert('先请登录为管理员');this.top.location.href='admin_login.asp';</script>")
response.end()
end if
%>
<!--#include file="inc\conn1.asp"-->
<%
if request.Form("o")="tianjia" then
if trim(Request.Form("username"))="" then
Response.Write("<script language=javascript>alert(' 用户名不能为空!')</script>")
Response.End()
end if
if trim(Request.Form("password"))="" then
Response.Write("<script language=javascript>alert('密码不能为空!')</script>")
Response.End()
end if
if trim(Request.Form("password"))<>trim(Request.Form("password1")) then
Response.Write("<script language=javascript>alert('两次密码必须相同,请重新输入!')</script>")
Response.End()
end if
set rs=server.CreateObject("adodb.recordset")
sql="select*from user "
rs.open sql,cn,1,3
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
cn.close
set cn=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()
end if
%>
我想判断数据库有没相同的用户.
我是用
set rs=server.CreateObject("adodb.recordset")
sql="select*from user where user="&request("user")
rs.open sql,cn,1,3
if rs.recordcount <>0 then
response.write "有相同用户"
else
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
cn.close
set cn=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()
应该怎么写
[此贴子已经被作者于2007-7-5 20:50:10编辑过]