if Level then i= i + NewFather OldCatalog = rsCatalog("CatalogID") NewCatalog = i REM 写入临时表 strSQL = "Insert into TempCatalog (OldCatalogID , NewCatalogID , OldFatherID , NewFatherID)" strSQL = strSQL & " values(" & OldCatalog & " , " & NewCatalog & " , " & OldFather & " , " & NewFather & ")" Conn.Execute strSQL REM 递归调用FormatAllID Nm = Nm + Ni(Level+1) FormatAllID oConn,OldCatalog , NewCatalog ,N,Nm,Ni,Level + 1 rsCatalog.MoveNext j = j+1 loop rsCatalog.Close end sub %>
调用这个算法的一个例子如下:
<% REM 定义编码参数,其中N为总位数,Ni为每一级的位数。 Dim N,Ni(5) Ni(1) = 4 N = Ni(1) for i=2 to 5 Ni(i) = 7 N = N + Ni(i) next REM 打开数据库,创建临时表 strSQL = "Create TempCatalog( [OldID] [int] NOT NULL, [NewID] [int] NOT NULL, [OldFatherID] [int] NOT NULL, [NewFatherID] [int] NOT NULL);" Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open Application("strConn") Conn.Execute strSQL REM 调用规格化例程 FormatAllID Conn,-1,-1,N,Ni(1),Ni,0 REM ------------------------------------------------------------------------ REM 在此处更新所有相关表的类别编码为新的编码即可。 REM ------------------------------------------------------------------------ REM 关闭数据库 strSQL= "drop table TempCatalog;" Conn.Execute strSQL Conn.Close %>
第四个问题 分页: [1] [2] [3] [4] [5] [6] [7] [8] [9] (编辑:网站学习网)
|