ajax+asp无限级分类树型结构的代码

2019-09-14 07:20:28于丽

            sParentPath=trim(rs("ParentPath"))& "," &nParentID    
            if cint(trim(nParentID))>0 then            '父id大于0则有父类别,故要插入的类别的深度父类别的深度加1,父id不大于0则当前要插入的类别为根类别,则深度为0
                nDepth=cint(trim(rs("Depth")))+1
            else
                nDepth=0
            end if
            if cint(trim(rs("Child")))>0 then
                dim rsPrevOrderID
                '得到与本栏目同级的最后一个栏目的OrderID
                set rsPrevOrderID=conn.execute("select Max(OrderID) From ArticleClass where ParentID=" & ParentID)
                prevOrderID=rsPrevOrderID(0)
                '得到同一父栏目但比本栏目级数大的子栏目的最大OrderID,如果比前一个值大,则改用这个值。
                set rsPrevOrderID=conn.execute("select Max(OrderID) From ArticleClass where ParentPath like '" & ParentPath & ",%'")
                if (not(rsPrevOrderID.bof and rsPrevOrderID.eof)) then
                    if not IsNull(rsPrevOrderID(0))  then
                         if rsPrevOrderID(0)>prevOrderID then
                            prevOrderID=rsPrevOrderID(0)
                        end if