ASP 当前记录上一条下一条的常规方法

DATE: 2016-11-10 / VIEWS: 846

参考:ASP 当前记录上一条下一条的另种方法

程序代码 程序代码

Set Objrs=ConnectDB.Execute("Select id,title From site_company Where id < "&sid&" order by id desc")
If Not Objrs.Eof Then
MinID=Objrs(0)
Minn=objrs(1)
Else
MinID=0
End If

Set Objrs=ConnectDB.Execute("Select id,title From site_company where id > "&sid&" order by id asc")
If Not Objrs.Eof Then
MaxID=Objrs(0)
Maxn=objrs(1)
Else
MaxID=0
End If

if MinID<>0 then
response.write("<a href=""index.asp?sid="&MinID&""">"&Minn&"</a>")
end if
if MaxID<>0 then
response.write("<a href=""index.asp?sid="&MaxID&""">"&Maxn&"</a>")
end if