用asp做一个注册页面

来源:百度知道 编辑:UC知道 时间:2024/06/14 09:52:29
怎么用注册名跟数据库中已有的用户名进行比较,有的提示已注册不上他注册

怎么用注册名跟数据库中已有的用户名进行比较?
设计一个处理注册信息的页面,有表单信息传过来的时候先打开数据库,用表单传过来的用户名与数据库里的用户名比较,如果有相等的就返回不能注册的提示
怎么比较?
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("db.mdb")
rs.open "select * from [数据表] where [user] = '"&request("user")&"'",conn,1,1
if rs.eof then
没有重名的处理
else
有重名的处理
end if

<% set rs=server.createobject("adodb.recordset")
sql="select*from zhuce where UserCount='"&UserCount&"'and Userpasswd='"&password&"'"
rs.Open sql,conn,1,2 //读取数据库已有的账号信息
if rs.EOF or rs.bof then
%> //判断账号是否存在
<%
//存储注册信息
rs.addnew
rs("UserCount")=UserCount
rs("password")=password
rs.update