打印

[asp] 接收参数判断时遇到了点问题。。。

功能是根据传过来的参数做相应的判断操作。。
在传参的时候有可能是三个参数中的一个、两个或三个。
不太明白为什么前两个不起作用,最后一个起作用。
aaa <> null 与 aaa <> "" 之间应该是"and"关系吧。
为什么写"or"反而起作用呢?

1,没有报错但也不起作用。
复制内容到剪贴板
代码:
aaa=trim(request("a"))
bbb=trim(request("b"))
ccc=trim(request("c"))
if aaa <> null or bbb <> null or ccc <> null then
if aaa <> null or aaa <> "" then
cc_rs("a")=aaa
end if
if bbb <> null or bbb <> "" then
cc_rs("b")=bbb
end if
if ccc <> null or ccc <> "" then
cc_rs("c")=ccc
end if
cc_rs.update
end if
2,同上。
复制内容到剪贴板
代码:
aaa=trim(request("a"))
bbb=trim(request("b"))
ccc=trim(request("c"))
if aaa <> null or bbb <> null or ccc <> null then
if aaa <> null and aaa <> "" then
cc_rs("a")=aaa
end if
if bbb <> null and bbb <> "" then
cc_rs("b")=bbb
end if
if ccc <> null and ccc <> "" then
cc_rs("c")=ccc
end if
cc_rs.update
end if
3,这是起作用的。
复制内容到剪贴板
代码:
aaa=trim(request("a"))
bbb=trim(request("b"))
ccc=trim(request("c"))
if aaa <> null or aaa <> "" or bbb <> null or bbb <> "" or ccc <> null or ccc <> "" then
if aaa <> null or aaa <> "" then
cc_rs("a")=aaa
end if
if bbb <> null or bbb <> "" then
cc_rs("b")=bbb
end if
if ccc <> null or ccc <> "" then
cc_rs("c")=ccc
end if
cc_rs.update
end if
[ 本帖最后由 yaokongshafa 于 2008-8-12 11:46 编辑 ]
性格决定命运。
null:是什么都没有

空:有值(空值)
学无止境

回复 2# Chikoo 的帖子

这个我知道额。
性格决定命运。
aaa=trim(request("a"))

改成

aaa=trim(request("a") & "")

下面判断只需要

if aaa <> "" then

其他同理
已经改变了能改变的,正在接受不能接受的!
Asp,Wap群:115737 C#.Net群:115746

wap 站:http://www.2ec.cn
免费WAP空间,免费二级域名

TOP

还在为头像烦恼?还在为不能关注好友动态烦忧?快来蓝色理想家园吧!

回复 4# lant 的帖子

这个方法倒是不错。
不过并没有解释我上面的疑问啊。
性格决定命运。

TOP

当参数里面不存在a时 request("a") 获得的值并不是 null
已经改变了能改变的,正在接受不能接受的!
Asp,Wap群:115737 C#.Net群:115746

wap 站:http://www.2ec.cn
免费WAP空间,免费二级域名

TOP

回复 6# lant 的帖子

获得的值不是null?
那是什么呢?
性格决定命运。

TOP

用 isnull 判断 null
if isnull(a) then

end if
天津杰明工作室:www.022jm.com

TOP