字典库父栏目下套子栏目,循环下去读取数据。

由于有人问这问题,就写了。

<%
StrSql = "SELECT ID, Name FROM TabArea Where len(id)=2"
set rsMain = server.CreateObject("ADODB.Recordset")
rsMain.open StrSql, conn, 3, 1
While Not rsMain.eof
 rid=rsMain("ID")
 rName=rsMain("Name")  
 Response.Write("<font Color=red >" & rid & ":"& rName & "</font><br>") 
 GetData(rid)
 Response.Write(  "==================================<br>")
 rsMain.movenext
Wend 
rsMain.Close

 

//循环套循环
Sub GetData(sId)
 intlen=Len(sId)
 set rsM = server.CreateObject("ADODB.Recordset")
 StrSql = "SELECT ID, Name FROM TabArea Where len(id)=" & intlen+2 & " and left(id,"&intlen& ")=" & sId  
 set rsM = server.CreateObject("ADODB.Recordset")
 rsM.open StrSql, conn, 3, 1 
 While Not rsM.eof  
  rid=rsM("ID")
  rName=rsM("Name")  
  Response.Write("<font size=" & len(rid) & ">" & rid & ":"& rName & "</font><br>")   
  GetData(rid)  
  rsM.movenext
 
 Wend 
 rsM.Close 
End sub    
%>

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页