读书人

错在哪里了呢?该怎么解决

发布时间: 2012-02-10 21:27:42 作者: rapoo

错在哪里了呢???????????
1行 <%
2行 select case request( "sheng ")=0 and request( "youdate ")= " " and request( "youdate2 ")= " " and request( "check ")= " " and request( "lanmu ") <> 0
3行 sql= "select * from [ "&request( "lanmu ")& "] where adminid is not null order by id desc "

4行 case request( "sheng ")=0 and request( "youdate ") <> " " and request( "youdate2 ") <> " " and request( "check ")= " " and request( "lanmu ") <> 0
5行 sql= "select * from [ "&request( "lanmu ")& "] where adminid is not null and addtime> = ' "&request( "youdate ")& " ' and addtime <= ' "&request( "youdate2 ")& " ' order by id desc "

6行case request( "sheng ") <> 0 and request( "youdate ")= " " and request( "youdate2 ")= " " and request( "check ")= " " and request( "lanmu ") <> 0
7行sql= "select * from [ "&request( "lanmu ")& "] where adminid is not null and sheng= ' "&request( "sheng ")& " ' order by id desc "

8行case request( "sheng ")=0 and request( "youdate ")= " " and request( "youdate2 ")= " " and request( "check ") <> " " and request( "lanmu ") <> 0
9行sql= "select * from [ "&request( "lanmu ")& "] where adminid is not null and recommend= ' "&request( "check ")& " ' order by id desc "

10行case request( "sheng ") <> 0 and request( "youdate ")= " " and request( "youdate2 ")= " " and request( "check ") <> " " and request( "lanmu ") <> 0
11行sql= "select * from [ "&request( "lanmu ")& "] where adminid is not null and sheng= ' "&request( "sheng ")& " ' and recommend= ' "&request( "check ")& " ' order by id desc "

12行case else
13行 response.write "查询不符合条件 "
14行 End Select
15行%>
单独执行每句都好用,放到select case里他就报第4行错误。把第2、3行去掉,在第4行加上select他就报第6行错误。把第4、5行也去掉,在在第6行加上select他就报第8行错误。以此类推。
请大家帮忙看看吧,找了两天毛病了,也没弄明白

------解决方案--------------------


晕,很久不看这样的代码了,头晕。

建议你把代码规范一下,查找起来更快。。

[解决办法]
你用的是if的写法
select的写法是
select 变量
case 值
end select
[解决办法]
先看一下你传递过来的参数都是什么值,不要老传同样的值来测试,让每次传递过来的值分别满足不同的条件,再看看结果!
[解决办法]
最好是先检测一下传过来的值,如:if request( "sheng ")= " " then request( "sheng ")=0
if len(request( "youdate "))=0 then request( "youdate ")= " "
怀疑你传过来的值有问题

[解决办法]
response.write (request( "sheng ")=0 and request( "youdate ")= " " and request( "youdate2 ")= " " and request( "check ")= " " and request( "lanmu ") <> 0)& " <br> "
response.write (request( "sheng ")=0 and request( "youdate ") <> " " and request( "youdate2 ") <> " " and request( "check ")= " " and request( "lanmu ") <> 0) )& " <br> "
response.write request( "sheng ") <> 0 and request( "youdate ")= " " and request( "youdate2 ")= " " and request( "check ")= " " and request( "lanmu ") <> 0 & " <br> "
response.write "================================== <br> "

[解决办法]
trim(request( "sheng "))全部加上这个trim!是int型的Cint转化int!试一试
[解决办法]
自己仔细检查检查,这不是什么大问题,自己信心点

读书人网 >ASP

热点推荐