asp分类显示的问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 10:26:04
数据库
----------------------------
id father name
2 0 xx
---------------------
father为0就是根接点如果为别的就是对应id的字接点
这样把他们按照
父接点
子接点
孙接点
这样的顺序输出
谢谢!

我的是这样做的
<%
sub showClass(parentID,level)
dim sql,rs,spacer,i
spacer = \"  \"
sql = \"select * from class where parentID=\" & parentID
set rs = server.CreateObject(\"ADODB.recordset\")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
exit sub
end if
while not rs.eof
for i=1 to level step 1
response.write spacer
next
response.write rs(\"className\") & \"<BR>\"

if rs(\"isHasChild\")=1 then
showClass rs(\"id\"),level+1
end if
rs.movenext
wend
end sub
showClass 0,0
%>

如果不是Oracle数据库比较麻烦
你可以先用
select nam