关于文章浏览里的上一条和下一条的实现方法
<a href="content.asp?pev=<%=rs("id")%>">上一条</a> <a href="content.asp?last=<%=rs("id")%>">下一条</a>
注意看上面的SQL语句!
If pev="" And last="" then
sql="select * from informains where chk='1' and id=" & CInt(id)
Else
If pev<>"" Then
sql="select top 1 * from informains where chk='1' and id<" & CInt(pev) & " order by id desc"
End If
If last<>"" Then
sql="select top 1 * from informains where chk='1' and id>" & CInt(last)
End if
End If
sql="select * from informains where chk='1' and id=" & CInt(id)
Else
If pev<>"" Then
sql="select top 1 * from informains where chk='1' and id<" & CInt(pev) & " order by id desc"
End If
If last<>"" Then
sql="select top 1 * from informains where chk='1' and id>" & CInt(last)
End if
End If
注意看上面的SQL语句!