最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
无限级目录数据库结构与方法一例
时间:2022-06-30 10:39:57 编辑:袖梨 来源:一聚教程网
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 = "" & rsdir("FolderName") & " > " & 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 > 表单 > )
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 = "" & rsdir("FolderName") & " > " & 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 > 表单 > )
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20