文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ASP之上一篇下一篇

ASP之上一篇下一篇

时间:2010-04-17  来源:mx11

 
代码
'******************************************************
'Depiction:ShowHead
'Param:CiassID 类别ID号
'        Article_id  当前文章ID号
'Returns:返回上一篇文章的链接
'******************************************************
Sub ShowHead(ClassID,Article_id)
    Sql = "Select top 1 * from Fzarticle Where Article_id > "& Article_ID &" And ClassID = "& ClassID &" order by Article_ID desc"
    Set HRs = Conn.Execute(Sql)
    If Not HRs.Eof Then
        Response.Write "<a href=ArticleShow.Asp?ClassID="&HRs("ClassID")&"&Article_id="&HRs("Article_id")&">"&HRs("title")&"</a>"
    Else
        Response.Write "已经是最前一篇了"
    End If
    HRs.Close
    Set HRs = Nothing
End Sub

'******************************************************
'Depiction:ShowNext
'Param:CiassID 类别ID号
'        Article_id  当前文章ID号
'Returns:返回下一篇文章的链接
'******************************************************
Sub ShowNext(ClassID,Article_id)
    Sql = "Select top 1 * from Fzarticle Where Article_id < "& Article_ID &" And ClassID = "& ClassID &" order by Article_ID desc"
    Set HRs = Conn.Execute(Sql)
    If Not HRs.Eof Then
        Response.Write "<a href=ArticleShow.Asp?ClassID="&HRs("ClassID")&"&Article_id="&HRs("Article_id")&">"&HRs("title")&"</a>"
    Else
        Response.Write "已经是最后一篇了"
    End If
    HRs.Close
    Set HRs = Nothing
End Sub
=================================================================================== 原版: <%
pid1=rs("id")
function Getpre
sql="select top 1 * from 数据表 where id>"&pid1&" order by id"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
response.Write("没有新闻了")
else
pid2=rs("id")
response.Write("<a href='文章页面.asp?id="&pid2&"'>"&rs("title")&"</a>")
end if
end function
function Getnext
sql="select top 1 * from 数据表 where id<"&pid1&" order by id desc"
set rs=conn.execute(sql)
if rs.eof then
response.Write("没有新闻了")
else
pid3=rs("id")
response.Write("<a href='文章页面.asp?id="&pid3&"'>"&rs("title")&"</a>")
end if
end function
%>
调用方法:
上一篇:<% getpre %>
下一篇:<% getnext %>
改进版: <% pid1=request("id")
rs.open "select top 1 * from info where id>"&pid1&" order by id",conn,1,1
if rs.eof or rs.bof then
getpre="·没有文章了!"
else
pid2=request("id")
getpre=getpre&"<a href='../info/"&pid2&"-1.htm'>"&rs("title")&"</a>"
end if
rs.close
pid3=request("id")
rs.open "select top 1 * from info where id<"&pid3&" order by id desc",conn,1,1
if rs.eof or rs.bof then
getnext="·没有文章了!"
else
pid4=request("id")
getnext=getnext&"<a href='../info/"&pid4&"-1.htm'>"&rs("title")&"</a>"
end if
rs.close
pencat=replace(pencat,"[GETPRE]",getpre)
pencat=replace(pencat,"[GETNEXT]",getnext)
%>
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载