Parental name with recursion to obtain unlimited classification getParentcategoryFullname

xiaoxiao2021-03-06  97

TABLENAME: ProductCategory CategoryId Auto Number ParentCategoryID Digital CategoryName Text

CategoryIdParentcategoryIDCateGoryName10 Featured Products 20 Software Products 30 Product Agents 41 Qing Dechang Series 51 Hydrotective Yield 61 Drilling Application Class 71 Special Industry Application Class

<% Function getParentCategoryFullName (CategoryID, conn, FullName) if CategoryID = 0 then getParentCategoryFullName = "no parent" exit function end if Set rs1 = Server.CreateObject ( "ADODB.Recordset") strSQL = "SELECT CategoryName, ParentCategoryID FROM ProductCategory WHERE Categoryid = "& Categoryid Rs1.open strsql, conn, 1, 1 tmpid = rs1.fields (1) .Value TmpName = rs1.fields (0) .value = not hardname <>" " = tmpName & "-" & FullName else FullName = tmpName end if if tmpID <> 0 then FullName = getParentCategoryFullName (tmpID, conn, FullName) end if getParentCategoryFullName = FullNameend function%>

转载请注明原文地址:https://www.9cbs.com/read-123874.html

New Post(0)