这样为什么不能实现贴子的分层?
前面省略若干......
dim pad
pad=""
do while not rs.eof and howmanyrecs<rs.pagesize
dim tempid
tempid=rs(0)
response.write("<b><a href=display.asp?id="&tempid&" target='_blank'>"&rs(2)&"</a></b>("&rs(5)&"于"&rs(4)&")<br>")
dispchild tempid,pad
rs.movenext
howmanyrecs=howmanyrecs+1
loop
Conn.close
set Conn=nothing
function dispchild(pid,padstr)
set rs1= Server.CreateObject("ADODB.Recordset")
sql="select count(*) from market where pid="&pid
set rs1=Conn.Execute(sql)
if rs1(0)>0 then
dim pad1
pad1=padstr&" "
sql="select * from market where pid="&pid&" order by id desc"
set rs1=Conn.Execute(sql)
do while not rs1.eof
dim tempid1
tempid1=rs1(0)
response.write(padstr&"<a href=display.asp?id="&tempid1&" target='_blank'>"&rs1(2)&"</a>("&rs(5)&"于"&rs1(4)&")<br>")
dispchild tempid1,pad1
rs1.movenext
loop
end if
end function
这样为什么不能实现贴子的分层,运行时贴子出现的顺序是对的,只是层次结构不正确!
也就是说缩进量不正确,其余的是对的