28,391
社区成员
发帖
与我相关
我的任务
分享
<%
id=request.QueryString("id")
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from shenbao where S_ID="&id
rs.open sqlstr,conn,1,3
%>
中间的内容省略这段内容没有问题 加了下面的上下篇功能出错求人帮忙看看
<%
rs.close
%>
<%
sql="select top 1 * from shenbao where S_ID < "&id&" order by S_ID"
rs.open sqlstr,conn,1,3
if rs.eof then
response.Write("")
else
id1=rs("S_ID")
response.Write("<a href='shgxx.asp?id="&id1&"'>上一篇</a>")
end if
rs.close
%>
<%
sql="select top 1 * from shenbao where S_ID > "&id&" order by S_ID"
rs.open sqlstr,conn,1,3
if rs.eof then
response.Write("")
else
id1=rs("S_ID")
response.Write("<a href='shgxx.asp?id="&id1&"'>下一篇</a>")
end if
%>
<%
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
set nRs=server.CreateObject("adodb.recordset")
sql="select S_ID from [shenbao] order by S_ID"
nRs.open sql,conn,1,1
nRs.find str&"="&int(id)
nRs.MovePrevious
if nRs.bof then
Response.write "没有上一条"
else
Response.write "<a href='shgxx.asp?id="&nRs(0)&"'>上一条</a> "
end if
nRs.Move 2
if nRs.eof then
Response.write "没有下一条"
else
Response.write "<a href='shgxx.asp?id="&nRs(0)&"'>下一条</a>"
end if
nRs.close:set nRs=Nothing