asp无限分级(递归调用)

所属分类: 网络编程 / ASP编程 阅读数: 309
收藏 0 赞 0 分享
数据库字段:id(自动编号),class_name(菜单名),parentID(父菜单id)
复制代码 代码如下:

<%
dim m 
m=0
call ShowTree(0)%>
<%
Sub ShowTree(parentID)
     dim s
     m=m+1
     Dim rs
     Set rs = Server.CreateObject("ADODB.RecordSet")
     sql="Select class_id,class_name FROM [WMS_Class] where class_father_id="&Cint(parentID)
     rs.open sql,Conn,1,1
     if rs.eof and m = 1 then
           response.Write("该频道暂无栏目")
     end if
     Do While Not rs.Eof
               response.Write rs(0)
               for n=1 to m
                 if n = m and m = 1 then
                       Response.Write ("╋")
                 elseif n = 1 then
                       Response.Write (" ")
                 elseif n = m then
                       Response.Write ("├")
                 else
                       Response.Write ("│")
                 end if
           next
             response.Write rs(1)&"<br>"
           Call ShowTree(rs(0))
           m=m-1
           rs.Movenext
     Loop
End Sub
%>
更多精彩内容其他人还在看

IIS访问ASP页面时报错The requested resource is in use.的解决办法

IIS访问ASP页面时报错The requested resource is in use.的解决办法
收藏 0 赞 0 分享

错误类型:Provider (0x80004005)未指定的错误 的一个处理方法

一般情况下asp可以正常运行,但只要连接数据库就提示,Microsoft JET Database Engine 错误'80004005'
收藏 0 赞 0 分享

关于“未指定的错误”的问题 的比较正解的解决方法

关于“未指定的错误”的问题 的比较正解的解决方法
收藏 0 赞 0 分享

关于asp+access的安全问题分析

关于asp+access的安全问题分析
收藏 0 赞 0 分享

把RS.GetRows看得更清楚

把RS.GetRows看得更清楚
收藏 0 赞 0 分享

ASP面向对象编程探讨及比较

ASP面向对象编程探讨及比较
收藏 0 赞 0 分享

ASP错误处理

ASP错误处理
收藏 0 赞 0 分享

web文件管理器的后续开发

web文件管理器的后续开发
收藏 0 赞 0 分享

上一篇,下一篇过程代码

上一篇,下一篇过程代码
收藏 0 赞 0 分享

一小偷类!!有兴趣的可以看看

一小偷类!!有兴趣的可以看看
收藏 0 赞 0 分享
查看更多