ASP design and use Class 2

Source: Internet
Author: User

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
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.