如何在ACCESS数据库中读取一个范围内新闻条数?

来源:百度知道 编辑:UC知道 时间:2024/06/01 05:09:04
我目前的代码是:
<%
t=0
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="Select * from News where BigClassName='在线教程' and SmallClassName='初级使用指南' order by id"
rs.Open sql,conn,1,1
if not Rs.eof then
do while not rs.eof
t=t+1
%>
现在想要从News->在线教程->初级使用指南 里面抽取第8-16条数据内容显示,不知道该怎么写?
请将修改后的源码补上来!谢谢!

在你的程序后加上

do while 8<t and t<16

....

“拼凑” SQL 语句:用两次 TOP 命令取得我们所要的数据(第8-16条记录,按id排)

SELECT * FROM ( SELECT TOP 8 * FROM ( SELECT TOP 16 * from News where BigClassName='在线教程' and SmallClassName='初级使用指南' order by id desc ) order by id asc ) order by id desc

给分吧!呵呵