新的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