asp循环有问题

来源:百度知道 编辑:UC知道 时间:2024/06/01 01:01:20
从数据库循环数据显示在页面上为什么最后一个数据会重复一遍
<div id="b01">
<div id="b01-title">
<strong>其   他</strong>

  
<%
if not qita.eof then
Do While Not qita.Eof
%> 
<a href="<%=qita("Rorders")%>"><%=qita("Rtitle")%></a>
<%
qita.movenext
loop
end if
%>
   <a href="AllInfo.asp">更多</a>>></div>
<!--b01-title-->
</div><!--b01-->
这是ASP语句
set qita = server.CreateObject("ADODB.RecordSet")
qita_sqls="select top 4 Rid,Rtitle,Rorders from Rewind_qita order by Rid desc"
qita.open qita_sqls,conn,1,1
这是部分数据库语句
请各位高手帮我看看,是不是哪里出了问题

加个判断试试,判断是否到最后一条记录

qita.movenext
if qita.Eof then
Exit do
End if
loop

把你的代码贴出来看看!

if not (qita.eof And qita.Bof) then
Do While Not qita.Eof
%>
<a href="<%=qita("Rorders")%>"><%=qita("Rtitle")%></a>
<%
qita.movenext
loop
end if

循环出是4条记录吗,如果是就说明是你数据库的问题?
你看看一共循环出了几条记录??????

<%
if not qita.eof then
While Not qita.Eof
%>
<a href="<%=qita("Rorders")%>"><%=qita("Rtitle")%></a>
<%
qita.movenext
wend
end if
%>
用这个试试

打开数据库看看表,是不是有重复的记录啊?