注册 登录
编程论坛 ASP技术论坛

判断字段为空用=不过,用<>就能过是什么原因?

ml3300 发布于 2012-07-24 17:58, 478 次点击
if Request.QueryString("Action")="sq" then
if rs("img")="" or rs("zil")="" or rs("zw")="" then
Response.Write ("<script>alert('信息不完整,请检查!');</script>")
else
rs("sqsh")=1
rs("shyj")=""
rs.Update
rs.Close
set rs=nothing
Response.Write ("<script>alert('申请成功!');location.href='user.asp';</script>")
end if
end if
当IMG ZIL ZW有为空时也能提交通过, 后来改成下面的,就正确了,
if Request.QueryString("Action")="sq" then
if rs("img")<>"" and rs("zil")<>"" and rs("zw")<>"" then
rs("sqsh")=1
rs("shyj")=""
rs.Update Response.Write ("<script>alert('申请成功!');location.href='dyzkz.asp';</script>")
else
Response.Write ("<script>alert('照片、资料、报考职位还有填写的!');</script>")
end if
end if

为什么?第一个错哪呢?
4 回复
#2
yms1232012-07-25 10:22
你的字段都是文本值?
#3
ml33002012-07-25 15:41
是啊,用isnull和trim?
#4
netlin2012-07-26 08:50
这段代码,从逻辑上看是没有问题的,
问题肯定出在:
rs("img")
rs("zil")
rs("zw")
这三个字段上!
请楼主在代码中加入一些检测和显示代码,就可以发现问题了!
#5
ml33002012-07-31 11:09
恩,谢谢2位回复
1