从第二条开始提取数据库中的信息

function Newstop2(SortPath)
  dim rs,sql,NewsName,NewFlag
  set rs = server.createobject("adodb.recordset")
  sql="select top 4 * from Qianbo_News where Instr(SortPath,'"&SortPath&"')>0 order by id desc"
  rs.open sql,conn,1,1
  if rs.eof then
      Response.Write " 暂无相关信息"&VbCrLf
  else
  rs.movenext
    do while not rs.eof  
   if now()-rs("AddTime")<=2 then
     NewsName=StrLeft(rs("NewsName"),20)  
     NewFlag=""
   else
     NewsName=StrLeft(rs("NewsName"),20)  
     NewFlag=""
   end If
  If ISHTML = 1 Then
   AutoLink = ""&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
  Else
   AutoLink = "NewsView.asp?ID="&rs("id")&""
  End If
  Response.Write "<li style=""height:20px"">&nbsp;<a href="""&AutoLink&""">"&NewsName&"</a></li>"
      rs.movenext
    loop
  end if
  rs.close
  set rs=nothing
end Function

 

注:rs.movenext     从当前位置向下移动一行

    rs.moveprevious 从当前位置向上移动一行
原文地址:https://www.cnblogs.com/liuswi/p/2754670.html