注册 登录
编程论坛 ASP技术论坛

搜索问题

kgdipbyve 发布于 2008-07-26 17:53, 577 次点击
_______________                   ________
|____title______|   ○  1  ⊙  2  |_搜索__|

比如数据库中的表2中有
title    content
1        123木头人
1        16549
1        7897  
1        54564
1        454565
搜索后只出现     123木头人字段  ,后面的就不出来,这是为什么?我想把后面的也显示出来
那要怎么做?



<%
set rsb=server.CreateObject("adodb.recordset")
if request("title")="1" then
sqlb="select * from Products where title='"&request.form("title1")&"'"
else
sqlb="select * from news where title='"&request.form("title1")&"'"
end if
rsb.open sqlb,conn,1,1
if rsb.eof then
Response.Write"<script>alert('对不起,没有相关资料');window.location='index.asp'</script>"
response.End()
else

%>

<table width="982" height="65" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><%=rsb("contnet")%></td>
    <td></td>
  </tr>
</table>
<%
rsb.movenext
end if
rsb.close
set rsb=nothing
%>


这是我做的搜索,只能查到头一个 后面的就查不到...

[[it] 本帖最后由 kgdipbyve 于 2008-7-26 17:54 编辑 [/it]]
3 回复
#2
octillion2008-07-26 21:07
你的代码模式:

If rs.eof then 提示错误,结束执行
输出一条记录

考虑如下代码模式:

If Rs.Eof then 处理错误,结束执行

While Not Rs.EOF
  输出一条记录
  Rs.MoveNext
Wend
#3
kgdipbyve2008-07-28 08:28
谢了,显示出来了
#4
mnb14782008-07-28 08:47
这么好的东西不顶,那还等什么呀











" border="0" />
[url=http://www.]校园狂少最新章节[/url]
1