Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function GenerateNestedMenus(ByVal fTableName As String, ByVal fID As String) As String
- Dim output As String = ""
- SetActionResult = "waiting_ReadMenu"
- Dim OutputData As String = ""
- Dim SQLCommand As String
- Dim _string As New CoreString
- SQLCommand = "(SELECT * FROM " & fTableName & " WHERE MenuParent=@ID AND Visible=1);(SELECT COUNT(*) AS rowsCount FROM " & fTableName & " WHERE MenuParent=@ID AND Visible=1)"
- Dim DR As SqlDataReader
- Dim DB As New DeepDB(__ConnectionString, SQLCommand, fTableName)
- DB.ddConnect()
- Dim IDParameter As New SqlParameter("@ID", fID)
- DB.ddAddParameper(IDParameter)
- Dim temp As String
- Try
- DR = DB.ddExecuteReader()
- While DR.Read
- DR.NextResult()
- If Not DR("rowsCount") Is Nothing Then
- temp &= Trim(DR("rowsCount"))
- End If
- temp = "<ul><li> " & Trim(DR("MenuName")) & vbCrLf
- _temp &= temp
- GenerateNestedMenus("menus", DR("id"))
- temp = "</li></ul>" & vbCrLf
- _temp &= temp
- End While
- output = _temp
- Catch exp As Exception
- SetErrorMessage = "ReadMenu():" & exp.Message
- SetActionResult = "error_ReadMenu"
- Finally
- DB.ddClose()
- End Try
- Return output & ErrorMessage
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement