[求助]怎么验证用户提交的用户名和数据库中的是否相同??
比如 用户名变量是:userid 数据库中也是 userid 怎样写一句代码让它们两个比较,如果相同,刚输入“已经有此用户”
不相同则执行下面代码!
谢谢啊!
2007-10-21 13:45
SQL
2007-10-21 13:50
<%
sql="select count(*) as count from user where userid="&request.form("userid")
rst.open sql,conn,1,1
rst.close
if count>=0 then
msgbox "用户名已存在"
else
msgbox "恭喜!此用户名可以使用"
end if
%>
我自己写的,还没有定义rst呢,你自己修改一下应该就可以了
[此贴子已经被作者于2007-10-21 13:56:03编辑过]

2007-10-21 13:54
2007-10-21 14:00
现在我知道,给代码贴出来,你们也看看
rs.open "select * from [user] where userid="&"'"&userid&"'",myconn,1,1
if not rs.EOF then
response.write "<script>alert('此用户名已有人注册,请重新选择')</script>"
谢谢你们
2007-10-21 15:02

2007-10-21 16:16

2007-10-21 16:37
2007-10-21 16:39
2007-10-21 16:41

2007-10-21 16:44