以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于生成json (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=137644) |
-- 作者:有点蓝 -- 发布时间:2019/7/11 17:40:00 -- For Each bm As String In bms jo("depart") = bm jo("count") = cint(dt.Compute("Count(uid)","department = \'" & bm & "\'")) jo("mans") = ja Dim i As Integer = 0 For Each dr As DataRow In dt.Select("department = \'" & bm & "\'") ja.Add(New JObject) ja(i)("uid") = cstr(dr("uid")) ja(i)("username") = cstr(dr("username")) i = i + 1 Next Next
|
-- 作者:有点蓝 -- 发布时间:2019/7/11 20:11:00 -- [此贴子已经被作者于2019/7/11 20:12:45编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/7/11 20:22:00 -- Dim jo As New JObject Dim ja As new JArray Dim jb As JArray Dim bms As String() = dt.GetComboListString("department").Split("|") Dim i As Integer = 0 For Each bm As String In bms Dim o As new JObject o("depart") = cstr(bm) o("count") = cint(dt.Compute("Count(uid)","department = \'" & bm & "\'")) jb = new JArray For Each dr As DataRow In dt.Select("department = \'" & bm & "\'") Dim o2 As new JObject o2("uid") = cstr(dr("uid")) o2("username") = cstr(dr("username")) jb.Add(o2) Next o("mans") = jb ja.Add(o) Next jo("depart") = ja
|