| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 561 人关注过本帖
标题:关于menu多级菜单栏绑定数据库问题
只看楼主 加入收藏
jianruide
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-2-3
  问题点数:0  回复次数:1   
关于menu多级菜单栏绑定数据库问题
各位大侠,menu绑定了数据库,有两表,一个是跟菜单,一个用于子菜单。现在只显示了跟菜单,子菜单显示不出来,求指导!!万分感谢!
da = New OleDbDataAdapter("select * from Department", conn)
            ds = New DataSet
            da.Fill(ds, "MyDepartment")
            DepartmentNum = ds.Tables("MyDepartment").Rows.Count
            Session("DepartmentNum") = DepartmentNum '将部门数量传递给session
            ReDim DepartmentName(DepartmentNum - 1)
            For i = 1 To DepartmentNum
                DepartmentName(i - 1) = ds.Tables("MyDepartment").Rows(i - 1).Item(1).ToString()
                Dim menunode As New MenuItem()   
                menunode.Text = DepartmentName(i - 1)  
                menunode.Value = DepartmentName(i - 1)  
                Menu1.Items.Add(menunode)  

                daTeam = New OleDbDataAdapter("select * from Team Where 部门= '" & DepartmentName(i - 1) & "'", conn)
                dsTeam = New DataSet
                daTeam.Fill(dsTeam, "MyTeam")
                TeamNum = dsTeam.Tables("MyTeam").Rows.Count
                If TeamNum > 0 Then
                    Session(i & "TeamNum") = TeamNum
                    ReDim TeamName(TeamNum - 1)
                    For j = 1 To TeamNum
                        TeamName(j - 1) = dsTeam.Tables("MyTeam").Rows(j - 1).Item(1).ToString

                        Dim menuchildnode As New MenuItem()   
                        menuchildnode.Text = TeamName(j - 1)
                        menuchildnode.Value = TeamName(j - 1)
                        ' Menu1.Items.Add(menuchildnode)   
                        Menu1.Items(0).ChildItems.Add(menuchildnode)  
                    Next j
                End If
            Next i
        End If
搜索更多相关主题的帖子: 绑定 数据库 New Tables Rows 
2019-04-07 18:17
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
  得分:0 
test

[此贴子已经被作者于2019-4-22 18:25编辑过]


QQ:63572063
2019-04-22 18:23
快速回复:关于menu多级菜单栏绑定数据库问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050127 second(s), 8 queries.
Copyright©2004-2019, BCCN.NET, All Rights Reserved