asp一直提示用户已被注册

来源:百度知道 编辑:UC知道 时间:2024/06/28 20:21:04
<!--#include file="inc.files.n/conn.asp"-->
<%
username=request("username")
sql="select * from [userinfo] where user='" & username & "'"
set rs=conn.excute(sql)
if rs("count")>0 then
msg="很遗憾,'" &username& "' 已经被注册!"
else
msg="恭喜你,'" & username & "' 还没被抢注!"
rs.close
set rs=nothing
end if

conn.close
set conn=nothing
%>
<html>
<script language="javascript">
<!--
function closewin(){
self.opener.history.go(-1);
self.close();}
function clock(){i=i-1
document.title="本窗口将在"+i+"秒后自动关闭!";
if(i>0)setTimeout("clock();",1000);
else closewin();}
var i=5
clock();
//-->
</script>
<%=msg%>
<a hr

if not rs.eof then
msg="很遗憾,'" &username& "' 已经被注册!"
else
msg="恭喜你,'" & username & "' 还没被抢注!"
rs.close
set rs=nothing
end if

你可能想用rs.recordcount>0
但是set rs=conn.execute(sql)
这种方法不支持rs.recordcount的
如果你想用这种方法需要用 rs.open

sql="select * from [userinfo] where user='" & username & "'" 中
user改成[user]