ASP读新闻上一条下一条问题
<%'判断上一条SetRs_R=Server.CreateObject("ADODB.RecordSet")sql_R="Selecttop1*FromQianbo_Ne...
<%
'判断上一条
Set Rs_R=Server.CreateObject("ADODB.RecordSet")
sql_R="Select top 1 * From Qianbo_News where id <"&ID
Rs_R.open sql_R,conn,1,1
if not Rs_R.eof then
response.Write("<a href=""readnew.asp?id="&Rs_R("id")&""">上一条 </a>")
else
response.Write(" ")
end if
Rs_R.Close()
Set Rs_R = Nothing
'判断下一条
Set Rs_N=Server.CreateObject("ADODB.RecordSet")
sql_N="Select top 1 * From Qianbo_News where id >"&ID
Rs_N.open sql_N,conn,1,1
if not Rs_N.eof then
response.Write("<a href=""readnew.asp?id="&Rs_N("id")&"""> 下一条</a>")
else
response.Write(" ")
end if
Rs_N.Close()
Set Rs_N = Nothing
%>
新闻一共分了三个栏目,每次点击上一条或者下一条都是跳到下一个ID。就可能跳到别的栏目去了。怎么让它判断是读某个栏目的下一条上一条。 展开
'判断上一条
Set Rs_R=Server.CreateObject("ADODB.RecordSet")
sql_R="Select top 1 * From Qianbo_News where id <"&ID
Rs_R.open sql_R,conn,1,1
if not Rs_R.eof then
response.Write("<a href=""readnew.asp?id="&Rs_R("id")&""">上一条 </a>")
else
response.Write(" ")
end if
Rs_R.Close()
Set Rs_R = Nothing
'判断下一条
Set Rs_N=Server.CreateObject("ADODB.RecordSet")
sql_N="Select top 1 * From Qianbo_News where id >"&ID
Rs_N.open sql_N,conn,1,1
if not Rs_N.eof then
response.Write("<a href=""readnew.asp?id="&Rs_N("id")&"""> 下一条</a>")
else
response.Write(" ")
end if
Rs_N.Close()
Set Rs_N = Nothing
%>
新闻一共分了三个栏目,每次点击上一条或者下一条都是跳到下一个ID。就可能跳到别的栏目去了。怎么让它判断是读某个栏目的下一条上一条。 展开
3个回答
展开全部
'得到分类
Set Rs_p=Server.CreateObject("ADODB.RecordSet")
Rs_p="Select top 1 * From Qianbo_News where id ="&ID
sortid=Rs_p("sortid")
Rs_p.Close()
Set Rs_p = Nothing
'判断上一条
Set Rs_R=Server.CreateObject("ADODB.RecordSet")
sql_R="Select top 1 * From Qianbo_News where id <"&ID" and sortid="&sortid&" order by id desc"
Rs_R.open sql_R,conn,1,1
if not Rs_R.eof then
response.Write("<a href=""readnew.asp?id="&Rs_R("id")&""">上一条 </a>")
else
response.Write(" ")
end if
Rs_R.Close()
Set Rs_R = Nothing
'判断下一条
Set Rs_N=Server.CreateObject("ADODB.RecordSet")
sql_N="Select top 1 * From Qianbo_News where id >"&ID" and sortid="&sortid&" order by id desc"
Rs_N.open sql_N,conn,1,1
if not Rs_N.eof then
response.Write("<a href=""readnew.asp?id="&Rs_N("id")&"""> 下一条</a>")
else
response.Write(" ")
end if
Rs_N.Close()
Set Rs_N = Nothing
Set Rs_p=Server.CreateObject("ADODB.RecordSet")
Rs_p="Select top 1 * From Qianbo_News where id ="&ID
sortid=Rs_p("sortid")
Rs_p.Close()
Set Rs_p = Nothing
'判断上一条
Set Rs_R=Server.CreateObject("ADODB.RecordSet")
sql_R="Select top 1 * From Qianbo_News where id <"&ID" and sortid="&sortid&" order by id desc"
Rs_R.open sql_R,conn,1,1
if not Rs_R.eof then
response.Write("<a href=""readnew.asp?id="&Rs_R("id")&""">上一条 </a>")
else
response.Write(" ")
end if
Rs_R.Close()
Set Rs_R = Nothing
'判断下一条
Set Rs_N=Server.CreateObject("ADODB.RecordSet")
sql_N="Select top 1 * From Qianbo_News where id >"&ID" and sortid="&sortid&" order by id desc"
Rs_N.open sql_N,conn,1,1
if not Rs_N.eof then
response.Write("<a href=""readnew.asp?id="&Rs_N("id")&"""> 下一条</a>")
else
response.Write(" ")
end if
Rs_N.Close()
Set Rs_N = Nothing
展开全部
sql_R="Select top 1 * From Qianbo_News where 栏目id="&接收过来的栏目ID&" id <"&ID
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<a href="news.asp?id=$_POST['id']&$lid=$_POST['liid']">
id是新闻的!!liid是栏目的!
id是新闻的!!liid是栏目的!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询