Topic review |
Posted: Wed 4:35, 09 Mar 2011 Post subject: 递归实现tree | |
dim myrs
dim lev lev=0 str="+" sqlstr="select id,dept_name,lev from cpb_dept where len(lev)=len("& uplev &")+1 and left(lev,len("&uplev&"))="& uplev & " and dept_name not like '%测试%' and flag=true order by lev " set rs=server.createobject("adodb.recordset") rs.open sqlstr,conn,1,3 If rs.RecordCount > 0 Then myrs=rs.GetRows() rs.Close Set rs = Nothing recN=UBound(myrs,Ghd Precious Gift Set Online,2) For i=0 To recN if len(myrs(2,i))<>lev then lev=len(myrs(2,i)) for ii=0 to lev str=str & "--" next end if 'Response.Write("ID: "&myrs(0,i)&", First: "&myrs(1,Ghd Benefit Hair Store,i)&", Second: "&myrs(2,i)&"<br />") Response.Write(str & "<img str=images/nofollow.gif>"& myrs(1,i)&"<br />") call tree(myrs(2,Turbo 1 Chi Iron,i)) Next else rs.Close Set rs = Nothing Exit sub end if end sub call tree("11") sub tree(UPlev) Many years ago there lived an Emperor who was so exceedingly fond of fine new clothes that he spent vast sums of money on dress. To him clothes meant more than anything else in the world. He took no interes related links: About PBS |