日期:2014-05-17  浏览次数:20869 次

一个调用问题,在线等
求高手帮我解决一个难题,在线等

代码如下   :

这段代码执行后,会调用数据表中的最新6条信息,,也是最新的,,现在想调用7-12条的信息,,如何做?

function   Topother1()
    dim   rs,sql,i,OthersName,OtherFlag
    set   rs   =   server.createobject( "adodb.recordset ")
    sql= "select   ID,OthersName,SortID,AddTime   from   NwebCn_Others   where   ViewFlag   order   by   id   desc "

    rs.open   sql,conn,1,1

    response.write " <table     width= '100% '   border= '0 '   cellspacing= '0 '   cellpadding= '0 '> "
    response.write   " <tr> <td   height= '14 '> </td> </tr> "
    if   rs.bof   and   rs.eof   then
        response.write   " <tr> <td   align= 'center '> 暂无相关信息 </td> </tr> "
    else
        for   i=1   to   6


            if   rs.eof   then   exit   for
      if   StrLen(rs( "OthersName ")) <=48   then

                OthersName=rs( "OthersName ")
   
      else  
          OthersName=StrLeft(rs( "OthersName "),46)
      end   if
      if   now()-rs( "AddTime ") <=2   then  
          OtherFlag= "&nbsp; <img   src= '../Images/New_01.gif '> "
      else
          OtherFlag= " "
      end   if

            response.write " <tr   > <td   class= 'ListTitle '> &nbsp;&nbsp; <FONT   style= 'FONT-SIZE:   12px;   COLOR:   #333333;   FONT-FAMILY:   Webdings '> 4 </FONT> &nbsp; <a   href= 'OtherView.asp?ID= "&rs( "id ")& "&SortID= "&rs( "SortID ")& " '> "&OthersName& " </a> "&OtherFlag& " </td> </tr> "

            rs.movenext
        next

    end   if
    response.write   " <tr> <td   height= '6 '> </td> </tr> "
    response.write " </table> "
    rs.close
    set   rs=nothing

end   function


------解决方案--------------------
select top 6 * from (select top 12 ID,OthersName,SortID,AddTime from NwebCn_Others where ViewFlag order by id desc) order by id asc