<!--#include file="../setting/conn.asp"-->



<%
reclass

SoonBiz.adsuccess("升级成功")
Sub reclass()
	'<syl>重新生成rootid,depth<by syl>
	Dim rs,i
	Dim arrs
	'<syl>全部规零<by syl>
	SoonBiz.execute("update "& sheethead &"_class set rootid=0")

	Set rs=SoonBiz.execute("select id from "& sheethead &"_class where pid=0")
	If Not rs.eof Then 
		arrs=rs.getrows(-1)
	End If 
	Rs.Close:Set Rs=Nothing  
	If isarray(arrs) Then 
		For i=0 To ubound(arrs,2) '<syl>循环一级分类<by syl>
			SoonBiz.execute("update "& sheethead &"_class set rootid="& arrs(0,i) &",depth=0 where id="&arrs(0,i))
			SoonBiz.execute("update "& sheethead &"_class set rootid="& arrs(0,i) &",depth=1 where pid="&arrs(0,i))
			Set rs=SoonBiz.execute("select id from "& sheethead &"_class where pid="&arrs(0,i))
			Do while Not rs.eof 
				SoonBiz.execute("update "& sheethead &"_class set rootid="& arrs(0,i) &",depth=2 where pid="&rs(0))
				rs.movenext
			loop
			Rs.Close:Set Rs=Nothing
		Next		
	End If 
End Sub
%>