账号通
    

账号  

密码  

2039

查看

0

回复
主题:[分享]栏目排序重置(适用6.5版) [收藏主题]  
cdware 当前离线

100

主题

0

广播

0

粉丝
添加关注
级别:一年级

用户积分:511 分
登录次数:40 次
注册时间:2006/9/17
最后登录:2015/8/7
cdware 发表于:2010/2/19 0:09:00   | 只看该作者 查看该作者主题 楼主 
做在线知识付费 选科汛云开店

新的6.5版还没来得急试用,先是导入了很多栏目,之后发现排序很乱,几百个栏目乱七八糟的,排序了很多次花了几个小时结果更乱,没办法还是写个函数来解决吧,结果又花了几个小时,刚试了下,还可以,至少不乱了

也许有人也能用得上,就分享出来吧

哪个高手再给指教下就更好了

Sub DoReset()
   Dim I,Tid,SQL
   Dim RS:Set RS=Conn.Execute("select ID,TJ,FolderName,root,FolderOrder from KS_Class Where TJ=1 Order BY root,folderorder")
   With KS
     .echo "<table><tr><td>Function</td><td>I</td><td>ID</td><td>TJ</td><td>FolderName</td><td>root</td><td>FolderOrder</td></tr>"
   I=1
   Do While Not RS.Eof
     .echo "<tr><td>DoReset</td><td>"&I&"</td><td>"&RS("ID")&"</td><td>"&RS("TJ")&"</td><td>"&RS("FolderName")&"</td><td>"&RS("root")&"</td><td>"&RS("FolderOrder")&"</td></tr>"
                    Conn.Execute ("update KS_Class set FolderOrder=" & I & " where ID='" & RS("ID") &"'")
'     .echo "<tr><td>DoReset</td><td>"&I&"</td><td>"&FolderID&"</td><td></td><td></td><td></td><td></td></tr>"
     I=FolderOrder(RS("ID"),RS("TJ"),I)
     I=I+1
     RS.MoveNext
   Loop
     .echo "</table>"
         End With
    RS.Close:Set RS = Nothing
   KS.Echo "<script>alert('恭喜,排序重置成功');location.href='KS.Class.asp?Action=OrderN'</script>"
End Sub
Function FolderOrder(FolderID,TJ,Order)
   Dim I,Tid,SQL
   Dim RS:Set RS=Conn.Execute("Select ID,TJ,FolderName,root,FolderOrder From KS_Class Where TJ=" & TJ+1 & " AND DelTF=0 AND TS LIKE '%" & FolderID & "%'")
   With KS
   I=Order
    If Not RS.EOF Then
   Do While Not RS.Eof
     I=I+1
     .echo "<tr><td>FolderOrder</td><td>"&I&"</td><td>"&RS("ID")&"</td><td>"&RS("TJ")&"</td><td>"&RS("FolderName")&"</td><td>"&RS("root")&"</td><td>"&RS("FolderOrder")&"</td></tr>"
                Conn.Execute ("update KS_Class set FolderOrder=" & I & " where ID='" & RS("ID") &"'")
    I = FolderOrderDoReset(RS("ID"),RS("TJ"),I)
     RS.MoveNext
   Loop
    Else
    End If
'     .echo "<tr><td>FolderOrder</td><td>"&I&"</td><td>"&FolderID&"</td><td></td><td></td><td></td><td></td></tr>"
   FolderOrder = I
         End With
    RS.Close:Set RS = Nothing
End Function

Function FolderOrderDoReset(FolderID,TJ,Order)
   Dim I,Tid,SQL
   Dim RS:Set RS=Conn.Execute("Select ID,TJ,FolderName,root,FolderOrder From KS_Class Where TJ=" & TJ+1 & " AND DelTF=0 AND TS LIKE '%" & FolderID & "%'")
   With KS
   I=Order
    If Not RS.EOF Then
   Do While Not RS.Eof
     I=I+1
     .echo "<tr><td>FolderOrderDoReset</td><td>"&I&"</td><td>"&RS("ID")&"</td><td>"&RS("TJ")&"</td><td>"&RS("FolderName")&"</td><td>"&RS("root")&"</td><td>"&RS("FolderOrder")&"</td></tr>"
                Conn.Execute ("update KS_Class set FolderOrder=" & I & " where ID='" & RS("ID") &"'")
    I = FolderOrder(RS("ID"),RS("TJ"),I)
     RS.MoveNext
   Loop
    Else
    End If
'     .echo "<tr><td>FolderOrderDoReset</td><td>"&I&"</td><td>"&FolderID&"</td><td></td><td></td><td></td><td></td></tr>"
   FolderOrderDoReset = I
         End With
    RS.Close:Set RS = Nothing
End Function

 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
<上一主题 | 下一主题 >
Powered By KesionCMS Version X1
厦门科汛软件有限公司 © 2006-2016 页面执行0.25391秒 powered by KesionCMS 9.0