<% '*********************************************************************** **************************** Assummed that you have established SQL Server Database Unittree and in the library Established on the table: 'Units (ID unit number unique, NAME unit name string, UPID superior unit number)' Note: UPID = 0 indicates that the unit is an root node unit; 'Enter some data such as: (1, AA , 0) (2, AABB, 1) (3, AACC, 1) (4, AABB11, 2) 'to perform the following program test.
%> <% 'Establishing Database Connection SET CONN = Server.createObject ("AdoDb.Connection") Conn.open "provider = SQLOLEDB; DATA SOURCE = YoursrcName; user ID = sa; password =; database = unittree"%> <% 'Sub Process: Generated Tree Knight Node Data SUB TREENODE (CODE) SQLUnit = "SELECT ID, NAME" & _ "from Units" & _ "Where Upid =" & Code & "" & _ "Order By ID" set = conn.execute (SQLUNIT) Do While NOT RSUNIT.EOF Response.write ("Node" & RSUNIT ("ID") & "= appendchild (" & "Node" & Code & ", FolderNode ('" & ritit ("name") & "', ' "& RSUNIT (" ID ") &" ', 0) "& chr (10)) Call Treenode (RSUnit (" ID ")) rsunit.movenext loop end subs%>