如何实现ASP上移下移

来源:百度知道 编辑:UC知道 时间:2024/05/05 08:44:09
网站上有很多上传的照片,按降序排列显示,想做一个可以上移下移的功能,这样就可以控制图片在页面显示的先后顺序,请哪位高手,给出源码,谢谢.解决了可以多加分.
不要用ID加减的,因为删除ID有可能是空的.

<%
OrderBy = request("OrderBy") '当前记录的排序序号 at_no ,at_id是记录的id 我这个表里id和序号是分开的
at_ID = request("at_ID") '当前记录id
action = request("action") '移动方向
if OrderBy="" or at_ID="" or action="" then
response.write "错误!!参数错误! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if

if action="Up" then '上移
'首先判断是不是已经移动到最前
sql="select top 1 at_ID from TaUserReqTop where at_no<"&OrderBy&" order by at_no desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof then '前边没有记录 了
rs.close
set rs=nothing
response.write "<script>alert('错误,该项目已经位于首位了');window.history.back();</script>"
response.end
end if