Foxtable(狐表)用户栏目专家坐堂 → 请教这个格式如何生成json


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

主题:请教这个格式如何生成json

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


加好友 发短信
等级:三尾狐 帖子:645 积分:5680 威望:0 精华:0 注册:2017/4/7 12:15:00
请教这个格式如何生成json  发帖心情 Post By:2021/2/24 14:19:00 [只看该作者]

var arr = [
{cn:"test",table:"补款表",re_col:"房号",re_v:row["房号"]},
{cn:"test",table:"车位成交表",re_col:"房号",re_v:row["房号"]},
{cn:"test",table:"地下室成交表",re_col:"房号",re_v:row["房号"]},
{cn:"test",table:"签约表",re_col:"房号",re_v:row["房号"]

}

以下代码报错:
无法将类型为“System.String”的对象强制转换为类型“Newtonsoft.Json.Linq.JToken”。

Dim drs As List(of DataRow)  = DataTables("关联表").SQLSelect("父表 = '" & e.Values("q") & "'")
For Each dr As DataRow In drs
            arr.Add(new jobject)
            arr(i)("cn") = "test".ToString
arr(i)("table") = dr("子表").ToString
arr(i)("re_col") = dr("父表关联列").ToString
arr(i)("re_v")=cstr("Row[""" & dr("子表关联列") & """]")
            i = i + 1
        Next
Dim count2=DataTables("关联表").SQLCompute("Count(*)", "父表 = '" & e.Values("q") & "'")
        obj("count") = count2.ToString
        obj("children") = arr

        e.WriteString(CompressJson(obj))

 回到顶部