asp 记录查询问题

this_2 2008-09-04 01:53:29
<!--#include file="conn.inc"-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<% if request.form("button1")="查询" then
if request.Form("text1")<>"" then
aa=trim(request.form("text1"))
sql = "select * from asd where 1=1"
sql = sql & "and zh like'"&aa&"'"
rs.open sql,conn,1,1
if rs.eof then
Response.Write("999")
else
response.write(" 查到1")
zh_temp=rs("zh")
xm_temp=rs("xm")
xb_temp=rs("xb")
end if
end if

else
if request.form("button2")="下一条" then
if request.form("text2")<>"" then
dim aa1
aa1=trim(request.form("text2"))
sql = "select * from asd "

rs.open sql,conn,1,1
do while not rs.eof
response.write(rs("zh"))
response.write(aa1)
if aa1=rs("zh") then
Response.Write("sdf ")
else
rs.movenext

Response.Write("rr ")
end if
loop

end if
end if

end if

%>
<form name="form1" method="post" action="xia1.asp">
<p>
<input type="text" name="text1" value="">
</p>
<p> </p>
<p>
<input type="text" name="text2" value="<%=zh_temp%>">
</p>
<p>
<input type="text" name="text3" value="<%=xm_temp%>">
</p>
<p>
<input type="text" name="text4" value="<%=xb_temp%>">
</p>
<p>
<input type="submit" name="button1" value="查询">
<input type="submit" name="button2" value="下一条">
</p>
<p>  </p>
<p>  </p>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>

</body>
</html>


不知道为什么 if aa1=rs("zh") then 不为真
...全文
101 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sy_binbin 2008-09-04
  • 打赏
  • 举报
回复
那你看看zh这个字段在表里是什么数据类型???
this_2 2008-09-04
  • 打赏
  • 举报
回复
rs.open sql,conn,1,1
do while not rs.eof
response.write(rs("zh"))
response.write(aa1)
这把 rs("zh")和aa1 输出后 是一样的
香椿炒鸡蛋 2008-09-04
  • 打赏
  • 举报
回复
aa1 和 rs("zh") 值确实相等么??
this_2 2008-09-04
  • 打赏
  • 举报
回复
那块 没有问题 if aa1=rs("zh") then
Response.Write("sdf ")
不知道 为什么不执行
sy_binbin 2008-09-04
  • 打赏
  • 举报
回复
sql = "select * from asd where 1=1"
sql = sql & "and zh like '%"&aa&"%'"



28,408

社区成员

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

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