<% Sub MaxLevels(intMenuID, intMaxCount, intLevel) if intMenuID = 0 then strSQL = "SELECT MenuID FROM CMS_Menu WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NULL" else strSQL = "SELECT MenuID FROM CMS_Menu WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID end if set rsMenuCount = con.execute(strSQL) if not rsMenuCount.EOF then do while not rsMenuCount.EOF MaxLevels rsMenuCount("MenuID"), intMaxCount, intLevel + 1 rsMenuCount.MoveNext loop end if set rsMenuCount = Nothing if intLevel > intMaxCount then intMaxCount = intLevel end if End Sub Sub GetSubs(intMenuID, strMainOption, intLevel) if intLevel < i_MenuLevels or IsNull(i_MenuLevels) then strSQL = "SELECT MenuID, MenuName, MenuOrder FROM CMS_Menu WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" ORDER BY MenuOrder" set rsSubMenus = con.execute(strSQL) do while not rsSubMenus.EOF i_MenuID = rsSubMenus("MenuID") s_MenuName = rsSubMenus("MenuName") Response.Write("" & VBCrLf) GetSubs i_MenuID, strMainOption &" \ "& s_MenuName, intLevel + 1 rsSubMenus.MoveNext loop set rsSubMenus = Nothing end if End Sub Sub DeleteSubs(intMenuID) strSQL = "SELECT MenuID FROM CMS_Menu WHERE MainMenuID = "& intMenuID set rsSubMenus = con.execute(strSQL) if not rsSubMenus.EOF then do while not rsSubMenus.EOF DeleteSubs rsSubMenus("MenuID") rsSubMenus.MoveNext() loop strSQL = "DELETE FROM CMS_Menu WHERE MainMenuID = "& intMenuID con.execute(strSQL) end if set rsSubMenus = Nothing End Sub Function GetMenuLine(intID) strSQL = "SELECT MainMenuID, MenuName FROM CMS_Menu WHERE MenuID = "& intID set rsMenu = con.execute(strSQL) if not rsMenu.EOF then rsMenu.MoveFirst() i_tmpMainMenuID = rsMenu("MainMenuID") s_tmpMenuName = rsMenu("MenuName") if Not IsNull(i_tmpMainMenuID) then GetMenuLine = GetMenuLine & GetMenuLine(i_tmpMainMenuID) end if GetMenuLine = GetMenuLine & s_tmpMenuName & " \ " end if set rsMenu = Nothing End Function %>