猫受惊吓大小便失禁:我选6条记录,为什么出来了11条???

来源:百度文库 编辑:高校问答 时间:2024/05/02 10:09:17
<!--#include file="inc/conn.asp"-->

<table width=93% align=center><%set rs=server.createobject("adodb.recordset")
rs.open "select Top 6 title,idxu,updatetime from article where idzz=16 and deleted=false order by updatetime desc",conn,1,1
if rs.recordcount=0 then%>暂无政策动态<%
else
while not rs.eof
%><tr><td><font color="#f14f0a">·</font><a href=zhengcedongtai.asp?idxu=<%=rs("idxu")%> target=_self><span class=13px><%if len(trim(rs("title")))>20 then
response.write left(trim(rs("title")),20)&"..."
else
response.write trim(rs("title"))
end if%></span></a></td><td class=riqi><%=rs("updatetime")%></td></tr>
<%rs.movenext%><%
wend
end if%><%rs.close
set rs=nothing%></table>

这个和你所用的数据库相关,select top n在不同的数据库中有两种含义,一是仅仅返回N条纪录(取前n名,如果有并列的那占两个位置),二是还包括所有于第N条等值的纪录(取前n名,如果有并列的只占据一个位置)。如果数据库支持的top n是第二种情况的话,返回的结果集就会大于n了