麻烦大侠帮我解释一下,小弟不胜感激!!

来源:百度知道 编辑:UC知道 时间:2024/09/18 05:08:53
dim ClassID1
Sub newsclass(ClassID)
dim strchildId,array_chid,intC,wsc_rs
strchildId=""
sql="select ID,ClassName,ChildID from Class where ID="&ClassID&" order by Sequence DESC"
set wsc_rs=oconn.execute(sql)
if not(wsc_rs.eof and wsc_rs.bof) then
do while not wsc_rs.eof
if isnull(wsc_rs("ChildID")) then
ClassID1=ClassID1&wsc_rs("ID")&","
Else
array_chid = split(wsc_rs("ChildID"),",")
For intC = 0 to Ubound(array_chid)
Call newsclass(array_chid(intC))
Next
End If
wsc_rs.movenext
loop
else
response.write ""
end if
End Sub

dim ClassID1
定义一个常量ClassID
Sub newsclass(ClassID)
执行过程(方法)传参数(所定义的变量)
sql="select ID,ClassName,ChildID from Class where ID="&ClassID&" order by Sequence DESC"
从Class 表中查询 ID ClassName ChildID以唯一降序的方式进行查询
查询条件为Class 表中id列的值等于你所定义的变量!
set wsc_rs=oconn.execute(sql)
oconn是一个执行对象,将执行查询语句的执行结果保存在wsc_rs集合里
if not(wsc_rs.eof and wsc_rs.bof) then
如果结果集里的eof属性和bof不一样,就
do while not wsc_rs.eof
循环wsc_rs.eof 以外的
not wsc_rs.eof
是循环条件
if isnull(wsc_rs("ChildID"))
如果集合属性 ChildID为空,
ClassID1=ClassID1&wsc_rs("ID")&","
ClassID1就按照ClassID1和
ID来保存
Else 否则,即ChildID不为空,即if isnull(wsc_rs("ChildID"))和
if not(wsc_rs.eof and wsc_rs.bof) 2个选择条件
条件不成立的话,执行下面语句
array_chid = split(wsc_rs("ChildID"),",")
把ChildID用,分隔开保存成集合
For intC = 0 to Ubound(array_chid)
从0到集合末尾进行for循环!
Call newsclass(ar