帮我下这段asp查询数据库的代码,哪里错了?

[复制链接]
查看11 | 回复2 | 2010-8-6 16:27:20 | 显示全部楼层 |阅读模式
0 then
state=1
errmsg="用户名里面不能有空格"
response.Write(errmsg)
exit sub
end if
if instr(1,dl,"'")0 then
state=1
errmsg="用户名里面含有非法字符"
response.Write(errmsg)
exit sub
end if
if len(pass)=0 then
state=1
errmsg="密码不能为空"
response.Write(errmsg)
exit sub
end if
%>

条件语句的意思是首先查询提交过来的user的值在数据库user字段是否为空,如果user不为空和dl为空则提示“未激活”。
第2个条件语句是如果在不满足第1个条件下提交过来的user,pass,dl数值对应不上数据库里的值就提示 :登录失败。
第3个条件语句是前1,2条件语句都不成立的时候就提示:ok。
高手帮我看下哪里出错了,我是新手,谢谢了,

回复

使用道具 举报

千问 | 2010-8-6 16:27:20 | 显示全部楼层
<%rs.open "select * from Users where user='" & dl & "' and Pass='" & pass & "'",con,1,1
if rs.bof and rs.eof then rs.close con.close set rs=nothing set con=nothing
state=1 errmsg="登陆失败,用户名或密码错误!!!" response.Write(errmsg) exit subelse if IsNull(rs("dl")) or rs("dl") = ""
回复

使用道具 举报

千问 | 2010-8-6 16:27:20 | 显示全部楼层
if not IsNull(rs("user")) and IsNull(rs("dl")) then改成下边的你试试的if IsNull(rs("user")) or IsNull(rs("dl")) then
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行