Foxtable(狐表)用户栏目专家坐堂 → 求助下


  共有1943人关注过本帖平板打印复制链接

主题:求助下

帅哥哟,离线,有人找我吗?
blackzhu
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57590 威望:0 精华:15 注册:2008/9/1 9:45:00
求助下  发帖心情 Post By:2020/7/23 16:32:00 [只看该作者]

我写了一个属性类

Public Class GetMenuModels
    Public Property title As String
    Public Property icon As String
    Public Property Spread As String
    Public Property children As List(Of Submenu)


    Public Class Submenu
        Public Property title As String
        Public Property icon As String
        Public Property href As String  
    End Class
End Class




但是函数的最下面遍历不到数据

 Dim dt As DataTable = SqlHelper.MyExecuteReader(SqlText)
        Dim js As JavaScriptSerializer = New JavaScriptSerializer()
        Dim DMenuInfo As New List(Of GetMenuModels)
        Dim outinfo As GetMenuModels = New GetMenuModels()
        Dim Arys As List(Of String())
        Arys = dt.GetValues("nav|lgicon|spread", "", "[no]")
        For Each Ary As String() In Arys
            '这边可以获取数据
            outinfo.title = Ary(0).ToString()
            outinfo.icon = Ary(1).ToString()
            outinfo.Spread = Ary(2).ToString()
            Dim item As New GetMenuModels.Submenu
            Dim Customers As List(Of String())
            Customers = dt.GetValues("navigation|smicon|Url", "nav='" & Ary(0).ToString() & "'", "[no]")
            For Each Customer As String() In Customers
                '这边可以获取数据
                item.title = Customer(0).ToString()
                item.icon = Customer(1).ToString()
                item.href = Customer(2).ToString()
            Next
            outinfo.children.Add(item)
        Next
        DMenuInfo.Add(outinfo)
      '  Dim json As String = js.Serialize(DMenuInfo)
      For each str As GetMenuModels In DMenuInfo  '这边遍历不到数据
        Output.Show(str.ToString)
            next
       ' Return json

是不是我哪边写错代码了?
[此贴子已经被作者于2020/7/23 16:33:08编辑过]

 回到顶部