ASP

本类阅读TOP10

·asp常用数据库连接方法和技巧
·VisualStudio.NET_2003及其 MSDN 下载地址
·session的用法具体解说
·MD5加密算法 ASP版
·JavaScript实现的数据表格:冻结列、调整列宽和客户端排序
·无组件生成BMP验证码
·一些常用的辅助代码 (网络收藏)
·ASP.net中md5加密码的方法
·ASP模拟MVC模式编程
·ASP.NET编程中的十大技巧

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
无限级目录数据库结构与方法一例

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

Folder 表:
Folderid:目录ID,自动编号
FolderParentID:上级目录ID,Int
FolderName:目录名称,Varchar
FolderDescription:目录说明,Varchar

File 表:
FileID:文档ID,自动编号
FileFolderID:所属目录ID,Int
FileName:文档名称,Varchar
FileDescription:文档内容,Varchar或备注(ntext)

function GetAllChildID(id)
    '取得FolderID为id的目录下所有子目录的FolderID,以半角逗号分开
    dim arrID
    arrID = id
    Set rsdir = Conn.Execute("Select FolderID,FolderParentID from [Folder] where FolderParentID = " & id & "")
    if rsdir.eof and rsdir.bof then
        set rsdir = nothing
        GetAllChildID = arrID
        exit function
    else
        while not rsdir.eof
            arrID = arrID & "," & GetAllChildID(rsdir("FolderID"))
        rsdir.movenext
        wend
    end if
    set rsdir = nothing
    GetAllChildID = arrID
end function


'从表File中取得某个目录下所有文档的Sql
dim AllChildID
AllChildID = GetAllChildID(5)    '取得FolderID为5下所有目录的FolderID
AllfileSql = "Select FileID,FileName from [File] where FileFolderID in ("& AllChildID &")"
?

function FolderPath(id)
    '得到一个目录的完整路径
    dim Pathstr,NewPathstr
    Set rsdir = Conn.Execute("Select FolderID,FolderName,FolderParentID from [Folder] where FolderID = " & id)
    if rsdir.bof and rsdir.eof then
        Pathstr = ""
    else
        Pathstr = "<a href=""Folder.asp?FolderID=" & rsdir("FolderID") &""">" & rsdir("FolderName") & "</a> > " & Pathstr
        if rsdir("FolderParentID") <> 0 then
            Pathstr = FolderPath(rsdir("FolderParentID")) & Pathstr
        end if
    end if

    NewPathstr = Pathstr
    set rsdir = nothing
    FolderPath = NewPathstr
end function

dim folderpathstr
folderpathstr = FolderPath(67)
response.write folderpathstr '输出 (技术文档 > Web开发 > ASP > Code Sample > 表单 > )




相关文章

相关软件




月光软件程序下载编程文档电脑教程网站设计网址导航网络文学游戏天地幽默笑话生活休闲写作范文安妮宝贝
电脑技术编程开发网络专区谈天说地情感世界游戏元素分类游戏热门游戏体育运动手机专区业余爱好影视沙龙
音乐天地数码广场教育园地科学大观古今纵横谈股论金人文艺术医学保健动漫图酷二手专区地方风情各行各业

月光软件站·版权所有