展开全部
<%
'id为当前id
set rs=Server.CreateObject("adodb.recordset")
rs.open "select top 1 * from News where BigClassName='News' and id>"&id&" order by ID asc",conn,1,1
if rs.recordcount>0 then
id2=rs("ID")
else
id2=""
end if
rs.close
set rs=nothing
set rs=Server.CreateObject("adodb.recordset")
rs.open "select top 1 * from News where BigClassName='News' and id<"&id&" order by ID desc",conn,1,1
if rs.recordcount>0 then
id3=rs("ID")
else
id3=""
end if
rs.close
set rs=nothing
%>
<tr>
<td align="center" valign="top" style="padding-top:10px; padding-bottom:20px;"><% if id3<>"" then%>[<a href="newsdetail.asp?id=<%=id3%>" class="hei"> Prev </a>] <% end if %> <% if id2<>"" then%>[<a href="newsdetail.asp?id=<%=id2%>" class="hei"> Next </a> ] <%end if%>[ <a href="news.asp" class="hei">Returm </a>]</td>
</tr>
'id为当前id
set rs=Server.CreateObject("adodb.recordset")
rs.open "select top 1 * from News where BigClassName='News' and id>"&id&" order by ID asc",conn,1,1
if rs.recordcount>0 then
id2=rs("ID")
else
id2=""
end if
rs.close
set rs=nothing
set rs=Server.CreateObject("adodb.recordset")
rs.open "select top 1 * from News where BigClassName='News' and id<"&id&" order by ID desc",conn,1,1
if rs.recordcount>0 then
id3=rs("ID")
else
id3=""
end if
rs.close
set rs=nothing
%>
<tr>
<td align="center" valign="top" style="padding-top:10px; padding-bottom:20px;"><% if id3<>"" then%>[<a href="newsdetail.asp?id=<%=id3%>" class="hei"> Prev </a>] <% end if %> <% if id2<>"" then%>[<a href="newsdetail.asp?id=<%=id2%>" class="hei"> Next </a> ] <%end if%>[ <a href="news.asp" class="hei">Returm </a>]</td>
</tr>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询