ASP移动数据记录问题,求大虾帮忙修改下!

来源:百度知道 编辑:UC知道 时间:2024/06/04 16:19:26
<%
Dim reQ_strCmds
reQ_strCmds =Request("Cmds")

If reQ_strCmds ="up" or reQ_strCmds ="down" Then Call MoveRec(reQ_strCmds)

Sub MoveRec(paR_strCmds)

Dim reQ_intID, reQ_intCID, intMove
reQ_intID =Request("ID")
reQ_intCID =Request("CID")
Set Rs =Conn.Execute("Select Move From [Product] where ID ="& reQ_intID)
intMove =Rs("Move")
Set Rs =Nothing

If paR_strCmds ="up" Then
Set Rs =Conn.Execute("Select Top 1 ID, Move From [Product] where typeid ="& reQ_intCID &" and Move <"& intMove)
If Not Rs.Eof Then
Conn.Execute("Update [Product] Set Move ="& Rs("Move") &" where ID ="& reQ_intID)
Conn.Execute("Update [Product] Set Move ="& intMove &" where ID ="&Rs("ID"))
End If
Set Rs =Nothing
Else

绝对能实现
if If paR_strCmds ="down" Then
str="Select Top 1 ID, Move From [Product] where typeid >"& reQ_intCID
else
str="Select Top 1 ID, Move From [Product] where typeid <"& reQ_intCID & "order by ID"

我估计你能看懂我的意思吧 连接数据库我就不写了

注意:提交的reQ_intCID是上一个数据集的typeid

建议你按照我的思路改动

向上的时候 选择大于插入点move的top 1的时候用move的升序

向下的时候 选择小于插入点move的top 1的时候用move的降序

然后再执行相应的交换move值的操作。