荣耀畅玩5x刷机包:[提问] 修改asp代码,asp代码大人请入内,恳请大人给解决,在线等

来源:百度文库 编辑:中科新闻网 时间:2024/04/19 12:22:26
代码如下 :
<%
rs.open "select * from detail where classid=2 and verity=1 order by hit desc",conn,1,3
jishu=1
'response.write "<tr bgColor=#fff2bf height=22>"

while not rs.eof

response.write "<td width='25%' height='20'>¦ <a href='gourl.asp?id="&rs("id")&"&url="&rs("url")&"' target='_blank' title='ID号:"&rs("id")&"〓简介:"&rs("memo")&"〓网址:"&rs("url")&"'>"&rs("title")&"<font color='#0000FF'>"&rs("tj")&"</font></a><font color='#ff0000'>[</font>"&rs("hit")&"<font color='#ff0000'>]</font></td>"

if jishu mod 8 =0 then
response.write "</tr><tr bgColor=#ffffff height=22>"
elseif jishu mod 4 =0 then response.write "</tr><tr bgColor=#fff2bf height=22>"
end if
jishu=jishu+1
rs.movenext
wend
jishu=jishu-1
if jishu mod 4 <> 0 then
for i= 1 to 4-(jishu mod 4)
response.write "<td width='25%'> </td>"
if i = 4-(jishu mod 4) then response.write "</tr>"
next
end if
rs.close
%>

以上功能实现的是调用ACCESS数据库里的全部内容,我要是只想调用其中的3行,或者是4行,\
修改代码:rs.open "select TOP 3 * from detail where classid=2 and verity=1 order by hit desc",conn,1,3

TOP 3 还是,好好的,到TOP7也是行的,但是到了TOP8就全部显示了,问题出在哪里?

付数据库图:
<img src=http://mfl.mop.com/static/upload_pic/06/0805/1154759658507.jpg><br>
谢谢,1楼的哥哥,但是我加了成了
rs.open "select top 12 * from detail where classid=1 and verity=1 order by hit desc and id desc",conn,1,3

提示有错误啊 1

order by 的问题,order by排在相同位置上的会被top语句当成一行,在order by中增加条件,确保没有相同排位的行就可以了,比如增加一个id desc之类的

应该是hit desc的问题,你自己去看看是不是到了top8后面的hit都是一样的。和楼上的一样,增加order by的条件。比如hit一样的就按id排。