请教 ASP里 新闻 上一篇 下一篇 代码那里出错,,请大家指点一二谢谢!
<%owen=request("id")%><%id=cstr(request("id"))Setrsnews=Server.CreateObject("ADODB.Re...
<%owen=request("id")%>
<%
id=cstr(request("id"))
Set rsnews=Server.CreateObject("ADODB.RecordSet")
sql="update news set hits=hits+1 where id="&id
conn.execute sql
sql="select * from news where id="&owen
rsnews.Open sql,conn,1,1
title=rsnews("title")
if rsnews.eof and rsnews.bof then
response.Write("数据库出错")
else
%>
------------------------
<div class="t_page">
<%
sql="select top 1 * from CT_article where ID<"&rsnews("id")
set rs_articletop=server.createobject("adodb.recordset")
rs_articletop.open SQL,conn,1,1
if rs_articletop.eof then
response.Write "<p class='left'>上一篇:没有了</p> "
else
%>
<p class="left">上一篇:<a href="?id=<%=rs_articletop("id")%>"><%=rs_articletop("title")%></a></p>
<%
end If
rs_articletop.close
%>
<%
sql="select top 1 * from CT_article where ID>"&rsnews("id")
set rs_articlenext=server.createobject("adodb.recordset")
rs_articlenext.open SQL,conn,1,1
if rs_articlenext.eof then
response.Write "<p class='right'>下一篇:没有了</p> "
else
%>
<p class="right">下一篇:<a href="?id=<%=rs_articlenext("id")%>"><%=rs_articlenext("title")%></a></p>
<%
end If
rs_articlenext.close
%>
</div> 展开
<%
id=cstr(request("id"))
Set rsnews=Server.CreateObject("ADODB.RecordSet")
sql="update news set hits=hits+1 where id="&id
conn.execute sql
sql="select * from news where id="&owen
rsnews.Open sql,conn,1,1
title=rsnews("title")
if rsnews.eof and rsnews.bof then
response.Write("数据库出错")
else
%>
------------------------
<div class="t_page">
<%
sql="select top 1 * from CT_article where ID<"&rsnews("id")
set rs_articletop=server.createobject("adodb.recordset")
rs_articletop.open SQL,conn,1,1
if rs_articletop.eof then
response.Write "<p class='left'>上一篇:没有了</p> "
else
%>
<p class="left">上一篇:<a href="?id=<%=rs_articletop("id")%>"><%=rs_articletop("title")%></a></p>
<%
end If
rs_articletop.close
%>
<%
sql="select top 1 * from CT_article where ID>"&rsnews("id")
set rs_articlenext=server.createobject("adodb.recordset")
rs_articlenext.open SQL,conn,1,1
if rs_articlenext.eof then
response.Write "<p class='right'>下一篇:没有了</p> "
else
%>
<p class="right">下一篇:<a href="?id=<%=rs_articlenext("id")%>"><%=rs_articlenext("title")%></a></p>
<%
end If
rs_articlenext.close
%>
</div> 展开
2个回答
展开全部
上一篇SQL语句应该为:
sql="select top 1 * from CT_article where ID<"&rsnews("id")&" order by id desc"
下一篇应该为:
sql="select top 1 * from CT_article where ID>"&rsnews("id")&" order by id asc"
sql="select top 1 * from CT_article where ID<"&rsnews("id")&" order by id desc"
下一篇应该为:
sql="select top 1 * from CT_article where ID>"&rsnews("id")&" order by id asc"
更多追问追答
追问
上一篇SQL语句应该为:
sql="select top 1 * from CT_article where ID"&rsnews("id")&" order by id asc"
还是一样的, 上一篇与下一篇没有链接..
追答
链接能不能点击?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询