网站制作

本类阅读TOP10

·IIS 安装配置全攻略
·用VS.NET打开网上下载的.NET web项目出错的解决办法
·HTML 4.0 语言快速参考
·限制TextArea区的文字输入数量
·如何在网页上实现进度条
·Apache的配置步骤及测试
·谈谈Jesse James Garrett提到的Ajax
·html基础学习笔记(2)
·页面垂直居中的两种方法
·用asp遍历目录下文件的例子

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
利用递归获得无限分类的父类名称getParentCategoryFullName

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

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
%>




相关文章

相关软件