一个上下移动的问题 急急急!!
我的一个 新闻列表 经理让做一个上下移动 我在表中加了一个 字段
id name idsub
1 li 2
2 dong 5
5 zhang 6
就想让 idsub 为5和6的 记录换位置
我在列表页 <% If i=1 then
response.write "no "
%>
<%else%>
<a href= "up_pro.asp?new_idsub= <%=rscyc( "new_idsub ")%> &page= <%=session( "page ")%> &j= <%=j%> ">
<font color= "blue "> 上移 </font> </a> <%End if%> |
<%If i=rscyc.recordcount then
response.write "no "
%>
<%else%>
<a href= "down_pro.asp?new_idsub= <%=rscyc( "new_idsub ")%> &page= <%=session( "page ")%> &j= <%=j%> ">
<font color= "blue "> 下移 </font> </a>
<%End if%>
这样传值过去 到 up_pro 页面
我的 up_pro.asp 页面是这样处理的 请帮我 看看
new_idsub=cint(request( "new_idsub "))
set rsdan=server.CreateObject( "adodb.recordset ")
sqldan= "select * from bm_news where new_delete=0 and new_idsub= ' "&new_idsub& " ' order by new_idsub asc "
rsdan.open sqldan,conn ,1,3
aa=rsdan( "new_id ") '61
bb=rsdan( "new_idsub ") '36
response.Write sqldan
'response.End()
set rscyc=server.CreateObject( "adodb.recordset ")
sql= "select top 1 new_id from bm_news where new_delete=0 and new_id> ' "&aa& " ' order by new_idsub asc "
rscyc.open sql,conn ,1,3
response.Write sql
'rscyc.movenext
cyc=rscyc( "new_id ")
set rsban=server.CreateObject( "adodb.recordset ")
sqlban= "select new_idsub from bm_news where new_delete=0 and new_id= ' "&cyc& " ' order by new_idsub asc "
rsban.open sqlban,conn ,1,3
response.Write sqlban
'response.End()
dd=rsdan( "new_idsub ")
rsdan( "new_idsub ")=dd
rsdan.update
rscyc.moveprevious
rsban( "new_idsub ")=bb
rsban.update
rscyc.Close
rsban.close
rsdan.close
set rscyc=Nothing
有点发懵 谢谢 大家了 100分相送
------解决方案--------------------要修改显示的顺序?order by idsub不就好了
------解决方案--------------------怎么看啊,一大堆,找出主要的迷惑的地方来问啊
方法应该是可以啊,我也做过类似的,不过数据多了以后,效率会成为问题
------解决方案--------------------我作的时候,其他排序和查询条件,都通过页面传值一股脑都传过去的