这样的条件判断怎么将变量引用?

powerc1 2004-08-11 05:27:18
<%
acz=3
aa="acz<5 and acz>1" '在页面中得到的多条件语句
if aa then
response.write "ok"
else
response.write "no"
end if
%>

系统提示类型不匹配,但是我不知道如何 将acz这个变量的3引入到aa这个语句中?请教大家。
...全文
164 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
EAGLEXU 2004-08-15
  • 打赏
  • 举报
回复

dim acz
acz=3
acz=Cint(acz)
if acz<5 and acz>1 then
response.write "yes"
else
response.write "no"
end if
这样没问题啊
powerc1 2004-08-15
  • 打赏
  • 举报
回复
请问有没有人可以回答?
powerc1 2004-08-15
  • 打赏
  • 举报
回复
还是不行,aa只能用aa=request.form("sr")从文本框中取,取回来是字符型,加()也没用,怎么办?
zltostem 2004-08-15
  • 打赏
  • 举报
回复
<%
acz=3
aa = (acz<5 and acz>1) '在页面中得到的多条件语句
if aa then
response.write "ok"
else
response.write "no"
end if
%>

这下没问题了,请参照~~~
powerc1 2004-08-15
  • 打赏
  • 举报
回复
if acz<5 and acz>1 then只能用if aa then来代替,因为条件不一定就是“acz<5 and acz>1”也许也有可能是“acz<4 and acz>2”,这要看用户如何输入,所以法上不能直接写if acz<5 and acz>1 then,但这里用变量aa代进来后系统提示出错,请问如何是好?
zltostem 2004-08-15
  • 打赏
  • 举报
回复
上面写法可以
AHUA1001 2004-08-14
  • 打赏
  • 举报
回复
这样的东西可以编译过去吗?
powerc1 2004-08-14
  • 打赏
  • 举报
回复
怎么都没有人回答呀,简单地说就是查询条件让用户自己在文本框中输入,如用户输入的是“acz<5 and acz>1”(acz代表一变量),在处理程序中用aa=request.form("sr")取回来的是一个“acz<5 and acz>1”字符串变量,但这不能用于 if aa then 用来做为判断的条件,因为字符型这样判断都为true,用"&aa&"也不行,请问大家如何办?
powerc1 2004-08-11
  • 打赏
  • 举报
回复
up
powerc1 2004-08-11
  • 打赏
  • 举报
回复
aa=acz<5 and acz>1
这样不行,因为页面中用到了多条件查询,所以大于或者小于都是用户选择的,所以在生成这个aa=“acz<5 and acz>1”的时候,用到了
temp=request.form(abc)
假设temp取到的是“>”
tempstr=tempstr&temp
tempstr就变成了acz>5
这样就一定要用字符,但是结果就成了我如果的问题,不能解决,请问大家有没有多条件查询的例子?
ttt2 2004-08-11
  • 打赏
  • 举报
回复
<%
acz=3
aa=acz<5 and acz>1 '在页面中得到的多条件语句
if aa=true then
response.write "ok"
else
response.write "no"
end if
%>
jervis82 2004-08-11
  • 打赏
  • 举报
回复
我觉得也没有多大可能啦,
字符的话除了零aa都为true
powerc1 2004-08-11
  • 打赏
  • 举报
回复
对,此时aa是个字符串常量,但是如何在if条件判断中将aa中的acz引用进去,这是个难题?请问有谁知道吗?
jervis82 2004-08-11
  • 打赏
  • 举报
回复
aa="acz<5 and acz>1"

此时aa已经为一个常量字符串了吧。

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧