tableName: ProductCategory
CategoryID 自动编号 ParentCategoryID 数字 CategoryName 文本
CategoryID |
ParentCategoryID |
CategoryName |
1 |
0 |
特色产品 |
2 |
0 |
软件产品 |
3 |
0 |
产品代理 |
4 |
1 |
清防垢系列类 |
5 |
1 |
油气井增产类 |
6 |
1 |
钻井应用类 |
7 |
1 |
特殊行业应用类 |
<% function getParentCategoryFullName(CategoryID,conn,FullName) if CategoryID=0 then getParentCategoryFullName="无父类" 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 rs1.close set rs1=nothing if FullName<>"" then FullName= tmpName & "-" & FullName else FullName=tmpName end if if tmpID<>0 then FullName=getParentCategoryFullName(tmpID,conn,FullName) end if getParentCategoryFullName=FullName end function %> 
|