asp+access生成无限层级目录探讨

时间:2024-03-18 15:13:13

asp+access生成无限层级目录探讨

asp+access生成无限层级目录探讨

conn.asp文件的内容
<%
dim connstr,conn,dbpath
set conn=server.CreateObject(“adodb.connection”)
dbpath=server.MapPath(“skin/images/hrmanagerdb.mdb”)
connstr=“provider=microsoft.jet.oledb.4.0;data source=”&dbpath
conn.open connstr
if conn.state=1 then
'response.Write(“数据库连接成功”)
else
response.Write(“数据库连接失败,请检查原因”)
end if

sub closeconn
conn.close
set conn=nothing
end sub

sub closers
rs.close
set rs=nothing
end sub

Function childtree(pid)
Set rst=server.CreateObject(“ADODB.RECORDSET”)
sql=“select * from fenlei where pid=”&pid
rst.open sql,conn,1,3
While(Not(rst.bof Or rst.eof))
response.Write “


    response.Write “

  • response.Write rst(“name”)
    childtree(rst(“id”))
    response.Write “

  • response.Write “

rst.movenext
Wend
rst.close
Set rst=Nothing
End Function
%>

下面是index.asp主文件内容

asp+access生成无限层级目录探讨