这里是一个根据发布时间调用的一个函数:
参数说明:
cTime=当前帖子的发布时间
gType=显示上一篇还是下一篇,为next表示显示下一篇的连接,否则显示上一篇的连接
<%
Function getToLink(cTime,gType)
If cTime = "" Or Not IsDate(cTime) Then
Exit Function
End If
Dim cnStr,returnStr,getSql,getRs
If gType = "next" Then
cnStr = " PublitTime<'"& cTime &"' Order By PublishTime Desc"
returnStr = "<font color='#999999'>已经是最后一篇了</font>"
Else
cnStr = " PublitTime>'"& cTime &"' Order By PublishTime Asc"
returnStr = "<font color='#999999'>已经是第一篇了</font>"
End If
getSql = "Select top 1 Id,Title From Web_Article Where "& cnStr
Set getRs = Conn.Execute(getSql)
If Not getRs.Eof Then
returnStr = "<a href=""NewsShow.Asp?newsid="& getRs("Id") &""">"& getRs("Title") &"</a>"
End If
getRs.Close()
Set getRs = Nothing
getToLink = returnStr
End Function
%>
条用方法:
上一篇:<%=getToLink(pubtime,"back")%>
下一篇:<%=getToLink(pubtime,"next")%>