搜索时为什么不能得到相对应的记录?

kyj826 2008-12-03 11:58:26
请问,在用DW做搜索时为什么不能得到相对应的记录,而只显示第一条记录?谢谢各位高手了!!!
部分代码如下:
<body>
<div align="center">
<p>搜索结果</p>
<p>您的年龄是:
<%
if NOT Recordset1.EOF then
response.write Recordset1.Fields.Item("学号").Value
else
response.write "无数据"
end if
%>
</p>
<form id="form1" name="form1" method="post" action="">
<table width="760" border="1" cellspacing="0" cellpadding="0">
<tr align="center">
<td>学号</td>
<td><%=(Recordset1.Fields.Item("学号").Value)%></td>
</tr>
<tr align="center">
<td>姓名</td>
<td><%=(Recordset1.Fields.Item("姓名").Value)%></td>
</tr>
<tr align="center">
<td>年龄</td>
<td><%=(Recordset1.Fields.Item("年龄").Value)%></td>
</tr>
<tr align="center">
<td>电话</td>
<td><%=(Recordset1.Fields.Item("电话").Value)%></td>
</tr>
<tr align="center">
<td>相片</td>
<td><%=(Recordset1.Fields.Item("相片").Value)%></td>
</tr>
</table>
</form>
<p>第一<%=(Recordset1_first)%>共有<%=(Recordset1_total)%>记录</p>
<p><a href="reseach.asp">返回上一页</a></p>
</div>
<p> </p>
</body>
...全文
73 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kyj826 2008-12-04
  • 打赏
  • 举报
回复
<%
if Recordset1.EOF then
response.write "没有数据"
else
Do While Not Recordset1.eof
Response.write Recordset1("年龄")
Recordset1.movenext
Loop
End If
Recordset1.close
Set Recordset1 = nothing

%>
这样哪不对呀?还是出不来?
帮帮忙吧!!!
micrologi 2008-12-03
  • 打赏
  • 举报
回复
这种显示记录的用循环就可以吧,怎么被你搞得那么复杂呢。
打开记录集以后用
do until Recordset1.eof'检查是否记录集末端
输出记录...
Recordset1.movenext'移到下一记录
loop'循环。

28,409

社区成员

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

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