動態載入樹 ASP 資料庫

2021-04-29 18:52:20 字數 1882 閱讀 8679

asp+access 在資料量達100萬條記錄下,載入速度仍然驚人....

// 網上**. 忘了作者...  : )

//**********************  index.asp ************************//

<%@language="vbscript" codepage="936"%>

<%option explicit%>

rs.open "select *,(select count(*) from deeptree where parentid = t.id) as children from deeptree t where parentid=0 order by parentid",conn,1,3

%>

<%

do while not rs.eof

if rs("children") = 0 then

s = "."

open = "no"

cls = "dirnode"

else

s = "+"

open = "false"

cls = "dirclose"

end if

%>

" class="td_node" valign="top">" id="dir<% = rs("id") %>" οnclick="expand(<%=rs("id")%>)" open="<% = open %>"><% = s %>

" οnclick="expand(<% = rs("id") %>)"  title="<% = trim(rs("content")) %>" href="<% = trim(rs("link")) %>"><% = rs("content") %>

<% if rs("children") > 0 then%>

" style="display: none">

.loading...

<%end if%>

<%

rs.movenext

loop

%>

<%

set rs = nothing

set conn = nothing

%>

///****************** subtree.asp *********************//

<%option explicit%>

<%

set conn = nothing

%>

//********************* node.htc *********************//

///****************** subtree.asp *********************//

<%option explicit%>

<%

set conn = nothing

%>

//********************* node.htc *********************//

//***************************  style.css ****************//

body

#txt

#hrf

#sb.node

.load

.td_node

#treedir

span.diropen

span.dirclose

.dirnode

// 把 node.htc, style.css 儲存與 css 目錄下. index.asp subtree.asp 放與根目錄.

另新建一access資料庫 tree.mdb

表deeptree 結構為 id,content, parentid,link

動態載入樹 ASP 資料庫

index.asp language vbscript codepage 936 option explicit rs.open select select count from deeptree where parentid t.id as children from deeptree t whe...

從資料庫動態載入選單

一 資料庫設計 系統選單表 column type comment idint 選單編號 menu name varchar 一級選單名 menu num varchar 所屬的一級選單編號 picture varchar 選單url varchar 選單鏈結 is use int是否使用 sort...

ASP基礎資料庫

選擇分類 class this.value 所有分類 sql select id,c name,c code from web news class where mn id getvariable mnid order by c code set rsclass conn.execute sql d...