asp無(wú)限分級(jí)(遞歸調(diào)用)
更新時(shí)間:2006年11月22日 00:00:00 作者:
數(shù)據(jù)庫(kù)字段:id(自動(dòng)編號(hào)),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("該頻道暫無(wú)欄目")
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
%>
復(fù)制代碼 代碼如下:
<%
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("該頻道暫無(wú)欄目")
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
%>
您可能感興趣的文章:
- 關(guān)于無(wú)限分級(jí)(ASP+數(shù)據(jù)庫(kù)+JS)的實(shí)現(xiàn)代碼
- 攻克CakePHP系列三 表單數(shù)據(jù)增刪改
- PHP數(shù)組無(wú)限分級(jí)數(shù)據(jù)的層級(jí)化處理代碼
- Android SQLite數(shù)據(jù)庫(kù)增刪改查操作的使用詳解
- PHP不用遞歸實(shí)現(xiàn)無(wú)限分級(jí)的例子分享
- jquery實(shí)現(xiàn)無(wú)限分級(jí)橫向?qū)Ш讲藛蔚姆椒?/a>
- 無(wú)限分級(jí)和tree結(jié)構(gòu)數(shù)據(jù)增刪改【附DEMO下載】
相關(guān)文章
新增加一個(gè)防垃圾評(píng)論的asp代碼,鄙視垃圾
最近開(kāi)通了,可以發(fā)表評(píng)論就一直被垃圾評(píng)論和留言困擾,一直沒(méi)有找到很好的解決辦法。今天發(fā)現(xiàn)了這個(gè)可以防止垃圾評(píng)論的asp代碼,特提供給大家,希望大家能擺脫2007-12-12ASP中格式化時(shí)間短日期補(bǔ)0變兩位長(zhǎng)日期的方法
這篇文章主要介紹了ASP中格式化時(shí)間短日期補(bǔ)0變兩位長(zhǎng)日期的方法,需要的朋友可以參考下2020-04-04對(duì)于ASP編碼問(wèn)題的深入研究與最終解決方案
對(duì)于ASP編碼問(wèn)題的深入研究與最終解決方案...2007-05-05判斷dll文件是否已經(jīng)注冊(cè)的ASP函數(shù)代碼
有時(shí)候需要判斷服務(wù)器是否按照了dll文件,那么就可以參考下面的代碼進(jìn)行判斷。2011-09-09asp分頁(yè)(自己整理的2個(gè)分頁(yè)程序)
asp下的分頁(yè)程序代碼2008-04-04ASP的URLDecode函數(shù)URLEncode解碼函數(shù)
我們知道,ASP的Server對(duì)象有個(gè)URLEncode方法可以對(duì)地址進(jìn)行編碼,但卻沒(méi)有相應(yīng)的解碼函數(shù),下邊的這個(gè)函數(shù)可以實(shí)現(xiàn)對(duì)URLEncode的解碼。2010-12-12ASP常見(jiàn)錯(cuò)誤詳解及解決方案小結(jié) 推薦
ASP是非常簡(jiǎn)單的,以至于許多的開(kāi)發(fā)者不會(huì)去思考錯(cuò)誤處理。錯(cuò)誤處理能夠讓你的應(yīng)用程序更加合理。我看到過(guò)很多個(gè)用ASP編寫(xiě)的商業(yè)網(wǎng)站,大多數(shù)都忽略了錯(cuò)誤處理。 錯(cuò)誤的類型。2011-01-01