莫名其妙的问题。。。。

mysite365 2009-10-16 04:10:10

<td width="285" height="31" bgcolor="#E4EBF1">
<FORM name=sou1 action="?cnmai=1" method=POST style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<p align="center">按帐号:<input type="text" name="T1" size="10">
<input type="submit" value="查找" name="B1">
</form>
</td>
<td width="285" height="31" bgcolor="#E4EBF1">
<FORM name=sou2 action="?cnmai=2" method=POST style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<p align="center">按姓名:
<input type="text" name="T2" size="10">
<input type="submit" value="查找" name="B1">
</form>
</td>
<td width="285" bgcolor="#E4EBF1">
<FORM name=sou3 action="?cnmai=8" method=POST style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<p align="center">按关键词:
<input type="text" name="T3" size="10">
<input type="submit" value="查找" name="B1">
</form>
</td>


<%
dim rs,sql,k,cnmai
dim ThisPage,Pagesize,Allrecord,Allpage
k=1
set rs = Server.CreateObject("ADODB.RecordSet")
cnmai=trim(request("cnmai"))
Select Case cnmai
Case "1"
sql="select * from [xinxi] where username='"&trim(request("T1"))&"' order by b desc"
Case "2"
sql="select * from [xinxi] where name like '%"&trim(request("T2"))&"%' order by b desc"
Case "3"
sql="select * from [xinxi] where biaoti like '%"&trim(request("T3"))&"%' or memo like '%"&trim(request("T3"))&"%' order by b desc"
Case Else
sql="select * from [xinxi] order by fbsj desc"
End Select


cnmai参数为1和2是都没问题,但是当为3是,自动跳到404页面。。。。。。。。。。

数据库:biaoti 文本型 memo 备注型

无语了。。。。。。。。。。。
...全文
66 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
number123456 2009-10-19
  • 打赏
  • 举报
回复
我决得问题不在你贴出的部份,应该在下边,当cnmai = 3的时候,你贴出的部份只是构建 SQL语句,执行SQL和执行SQL后的代码是什么呢?
lzp4881 2009-10-19
  • 打赏
  • 举报
回复
应该是数据类型或数据内容的问题,你先不要在内容中查询直接在标题中查询试试,也就是去掉or memo like '%"&trim(request("T3"))&"%'这部分试试。如果正常说明是数据内容或数据类型有问题。
mysite365 2009-10-19
  • 打赏
  • 举报
回复

<td width="285" bgcolor="#E4EBF1">
<FORM name=sou3 action="?cnmai=3" method=POST style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<p align="center">按关键词:
<input type="text" name="T3" size="10">
<input type="submit" value="查找" name="B1">
</form>
</td>

haiwei323 2009-10-16
  • 打赏
  • 举报
回复
按照你的HTML代码,你能执行到 case "3" 吗?

貌似执行不到吧?因为你第三个表单提交的参数是 ="?cnmai=8
暴走的车轮 2009-10-16
  • 打赏
  • 举报
回复
先打印一下 为3的时候sql语句是什么 看看是不是你想要的。如果是,放到查询分析器里执行一下,看出错不出错。如果不出错,就检查其他地方,如果出错就检查sql
mysite365 2009-10-16
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hookee 的回复:]
MEMO是保留字吧

VBScript code
sql="select * from [xinxi] where biaoti like '%"&trim(request("T3"))&"%' or [memo] like '%"&trim(request("T3"))&"%' order by b desc"
[/Quote]

测试了,问题依旧。。。。。。。。。
mysite365 2009-10-16
  • 打赏
  • 举报
回复
我先测试看看
hookee 2009-10-16
  • 打赏
  • 举报
回复
MEMO是保留字吧


sql="select * from [xinxi] where biaoti like '%"&trim(request("T3"))&"%' or [memo] like '%" & trim(request("T3")) & "%' order by b desc"
mysite365 2009-10-16
  • 打赏
  • 举报
回复
人工顶置。。

28,391

社区成员

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

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