ASP design and use Class 2
<%
Class classlist
Private currentclassid
Private currenttablename
Private parentclassid
Private currentclassname
Public property let classid (STR)
Currentclassid = Str
End Property
Public property let classtable (STR)
Currenttablename = Str
End Property
Public property let parentid (STR)
Parentclassid = Str
End Property
Public property let classname (STR)
Currentclassname = Str
End Property
Dim list ()
Dim I, n
Private sub class_initialize () 'initialization variable
I = 0
N = 0
End sub
'If this category ID exists, all subcategory IDs corresponding to the subcategory ID will be queried.
Public Function classarray (thisid, pid) 'gets the sublevel ID
'If data exists, recursively call the subclass classid, classname, and the total number of accumulated records.
If pid> 0 then
SQL = "select * from" & currenttablename & "where" & parentclassid & "=" & thisid
Else
SQL = "select * from" & currenttablename & "where" & currentclassid & "=" & thisid
End if
Set rs_c1_conn.exe cute (SQL)
N = n + 1
Do while not rs_c.eof
Response. Write ("execution statement" + I + "times ")
List (0, I) = rs_c (currentclassid) 'is loaded into the array.
List (1, I) = rs_c (currentclassname)
List (2, I) = N
'N' = n + 1
I = I + 1
Thisid = classarray (rs_c (currentclassid), 1)
'Here, the subcategory is recursively called until the last subclass
Rs_c.movenext
Loop
'Total number of accumulated records
N = n-1
Rs_c.close
Set rs_c = nothing
Response. End ()
End Function
Public Function arraylist () 'loops through all root classes
Set rs_c1_conn.exe cute ("select count (" & currentclassid & ") from" & currenttablename)
Lenght = rs_c (0)
Rs_c.close
Set rs_c = nothing
If not isnull (lenght) and lenght> 0 then
Redim list (2, lenght) 'sets the Array
Set rs1=conn.exe cute ("select" & currentclassid & "from" & currenttablename & "where" & parentclassid & "= 0 ")
Do while not rs1.eof
Call classarray (RS1 (currentclassid), 0)
'N' = 1
Rs1.movenext
Loop
Rs1.close
Set RS1 = nothing
Else
Response. Write ("no category ")
Response. End ()
End if
Arraylist = List
End Function
End Class
%>