Dim dt As DataTable = Nothing
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "SE LECT * FROM 功能导航 WHERE URL IS NOT NULL"
dt = cmd.ExecuteReader
Dim jo As New JObject
Dim ja As New JArray
Dim i As Integer = 0
Dim Arys As List(Of String())
Arys = dt.GetValues("一级菜单|大图标") '列名用符号|分割
For Each Ary As String() In Arys
ja.Add(New JObject)
ja(i)("text") = Ary(0).ToString()
ja(i)("iconCls") = Ary(1).ToString()
Dim jja As New JArray
ja(i)("children") = jja
Dim j As Integer = 0
Dim Customers As List(Of String())
Customers = dt.GetValues("二级菜单|小图标", "一级菜单='" & Ary(0) & "'")
For Each Customer As String() In Customers
jja.Add(New JObject)
jja(j)("text") = Customer(0).ToString
jja(j)("iconCls") = Customer(1).tostring()
j += 1
Next
i+=1
Next
Dim json As String = jo.ToString
Output.Show(json)
我想要这样的格式
{
text: '统计数据',
iconCls:
'icon-sum',
children:
[{
text: '统计销售量'
},{
text: '统计销售额'
},{
text: '统计市占率',
children:
[{
text: '传统渠道'
},{
text: '电商渠道'
}]
}]
},{
text: '权限设置',
iconCls:
'icon-edit',
children:
[{
text: '数据录入权限'
},{
text: '数据查询权限'
},{
text: '数据统计权限'
}]
}