28,391
社区成员
发帖
与我相关
我的任务
分享
<%
Function getMenu(pFunction)
Dim pf
pf = "" & pFunction
Dim RsGongNeng
Set RsGongNeng = Server.CreateObject("ADODB.Recordset")
RsGongNeng.ActiveConnection = MM_DbMain_STRING
RsGongNeng.Source = "SELECT * FROM XiTongGongNeng WHERE FuBianMa = '" & pf & "' AND IsShow = '1' ORDER BY PaiXu"
RsGongNeng.CursorType = 1
RsGongNeng.CursorLocation = 2
RsGongNeng.LockType = 1
RsGongNeng.Open()
Dim MenuStr
MenuStr = ""
If(RsGongNeng.RecordCount > 0) Then MenuStr = MenuStr + "<ul>"
While ((Not RsGongNeng.Bof) AND (NOT RsGongNeng.EOF))
MenuStr = MenuStr & "<li><a href=""" & RsGongNeng.Fields.Item("LianJieDiZhi").Value & """>" & RsGongNeng.Fields.Item("MingCheng").Value & "</a></li>"
'此处递归调用
MenuStr = MenuStr & getMenu(RsGongNeng.Fields.Item("FuBianMa").Value & "")
RsGongNeng.MoveNext()
Wend
If(RsGongNeng.RecordCount > 0) Then MenuStr = MenuStr + "</ul>"
getMenu = MenuStr
End Function
%>
<%
response.Write(getMenu("0"))
%>
<%
Function getMenu(pFunction)
Dim RsGongNeng
Set RsGongNeng = Server.CreateObject("ADODB.Recordset")
RsGongNeng.ActiveConnection = MM_DbMain_STRING
RsGongNeng.Source = "SELECT * FROM XiTongGongNeng WHERE FuBianMa = '" & pFunction & "' AND IsShow = '1' ORDER BY PaiXu"
RsGongNeng.CursorType = 1
RsGongNeng.CursorLocation = 2
RsGongNeng.LockType = 1
RsGongNeng.Open()
Dim MenuStr
MenuStr = ""
DO while NOT RsGongNeng.EOF
MenuStr = MenuStr & "<li><a href=""" & RsGongNeng("LianJieDiZhi") & """>" & RsGongNeng("MingCheng") & "</a></li>"
MenuStr = MenuStr & getMenu(RsGongNeng("BianMa"))
MenuStr = MenuStr & "</li>"
RsGongNeng.MoveNext()
Wend
if MenuStr <> "" then
MenuStr = "<ul>" & MenuStr & "</ul>"
end if
'这里最好关闭下
RsGongNeng.close
set RsGongNeng
getMenu = MenuStr
End Function
%>
<%
response.Write(getMenu(0))
%>