递归出父ID过程出错,请大家批点
表结构:
Classid ParentClassID
6239 17
17 8
8 1
1 0
目的是,通过递归调出所处结点以上的所有父级ID的集合,请高手指点我的问题出在哪里,我实在想不通了!
Function GetPIDs(CID)
Set Grs = Server.CreateObject( "ADODB.RecordSet ")
Grs.Open "Select ParentClassID From ClassTable where ClassID = ' "&Trim(CID)& " ' ",oConn,1
if Not(Grs.bof and Grs.eof) then
IDstr = Grs( "ParentClassID ")& ", "
if Grs( "ParentClassID ") = 0 then
GetPIDs = IDstr
exit Function
else
Call GetPIDs(Grs( "ParentClassID "))
end if
else
GetPIDs = IDstr
end if
Grs.Close
Set Grs = Nothing
GetPIDs = IDstr
End Function
------解决方案--------------------点数有点儿少,再加点儿.^__________^