ASP里,要显示第11-20条新闻标题,该怎么弄?
请教:原来的语句可以显示第1-10条新闻标题:"selecttop10*from"&db_skycom_Article_Table&"where(skycom_typei...
请教:原来的语句可以显示第1-10条新闻标题:
"select top 10 * from"& db_skycom_Article_Table &" where (skycom_typeid=20 and Checked=1 ) order by istop DESC,skycom_ArticleID DESC"
现在我想显示第11-20条新闻标题,应该怎么修改?请帮我给出完整修改的代码,谢谢~ 展开
"select top 10 * from"& db_skycom_Article_Table &" where (skycom_typeid=20 and Checked=1 ) order by istop DESC,skycom_ArticleID DESC"
现在我想显示第11-20条新闻标题,应该怎么修改?请帮我给出完整修改的代码,谢谢~ 展开
展开全部
set rs = server.CreateObject("adodb.recordset")
rs.open "select top 20 * from "& db_skycom_Article_Table &" where (skycom_typeid=20 and Checked=1 ) order by istop DESC,skycom_ArticleID DESC",conn,1,1
if rs.eof and rs.bof then
response.Write "还没有新闻"
else
i=1
do while not rs.eof
if i<=10 then
else
response.Write "输出的内容"
end if
rs.movenext
i=i+1
loop
rs.close
set rs = nothing
end if
rs.open "select top 20 * from "& db_skycom_Article_Table &" where (skycom_typeid=20 and Checked=1 ) order by istop DESC,skycom_ArticleID DESC",conn,1,1
if rs.eof and rs.bof then
response.Write "还没有新闻"
else
i=1
do while not rs.eof
if i<=10 then
else
response.Write "输出的内容"
end if
rs.movenext
i=i+1
loop
rs.close
set rs = nothing
end if
展开全部
这个要看你的数据库用的是什么,如果是SQL2005及以上的版本的,可以使用下面的代码
select * from (
select *,ROWNUM OVER (order by istop DESC,skycom_ArticleID DESC ) ROWID from "& db_skycom_Article_Table &"
where (skycom_typeid=20 and Checked=1)
) X WHERE X.ROWID BETWEEN 11 AND 20
select * from (
select *,ROWNUM OVER (order by istop DESC,skycom_ArticleID DESC ) ROWID from "& db_skycom_Article_Table &"
where (skycom_typeid=20 and Checked=1)
) X WHERE X.ROWID BETWEEN 11 AND 20
追问
是access的数据库呢,该怎么修改呢?谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询