以文本方式查看主题 - 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=143773) |
-- 作者:hopestarxia -- 发布时间:2019/12/4 9:06:00 -- JSON数据接收 新增了一个窗口,窗口中table插件, 新增了一命名为“接收”的按钮插件,里面代码如下: Dim hc As new HttpClient("http://qingyun-test.feiyang56.cn/fyhd//ifs/inbound_queryDetailList_resultAction.action") Dim jo As New JObject jo("userName") = "张博" jo("userPass") = "123456" jo("startDate") = "2019-12-02 00:00:00" jo("endDate") = "2019-12-02 23:59:59" jo("orderNo") = "" jo("currentPage") = "1" jo("pageSize") = "100" Dim orderJson As String =CompressJson(jo) msgbox(orderJson ) hc.FormData.Add("param",orderJson ) Dim dt As DataTable = hc.GetDataTable() Tables("窗口1_Table1").DataSource = dt 我想实现点接收按钮,则将接收到的数据存在窗口table,请问老师,代码应如何修改? |
-- 作者:有点蓝 -- 发布时间:2019/12/4 9:21:00 -- 接收的数据是json?那要自己解析然后逐个单元格赋值:http://www.foxtable.com/mobilehelp/topics/0140.htm dim ret = hc..GetData() Dim jo As JObject = JObject.Parse(ret ) Output.Show(jo("name")) |
-- 作者:hopestarxia -- 发布时间:2019/12/4 11:38:00 -- 谢谢老师,先试试。 |
-- 作者:hopestarxia -- 发布时间:2019/12/7 0:53:00 -- 老师,研究了还没研究出来。 此主题相关图片如下:55555.png 以下代码是参考老师发的帮助和其他示例文档,但是实现不了,请问该如何修改? Dim hc As new HttpClient("http://qingyun-test.feiyang56.cn/fyhd//ifs/inbound_queryDetailList_resultAction.action") Dim jo As New JObject jo("userName") = "张博" jo("userPass") = "123456" jo("startDate") = "2019-12-02 00:00:00" jo("endDate") = "2019-12-02 23:59:59" jo("orderNo") = "" jo("currentPage") = "1" jo("pageSize") = "100" Dim orderJson As String =CompressJson(jo) msgbox(orderJson ) hc.FormData.Add("param",orderJson ) Dim ret = hc.GetData For Each ep As JToken In JArray.Parse(ret) Dim rr As Row=Tables("sjb").addnew() rr("inboundNo")=ep("inboundNo") rr("inboundDate")=ep("inboundDate") Next |
-- 作者:有点蓝 -- 发布时间:2019/12/7 8:52:00 -- 把返回的结果发上来,文字,不是截图 [此贴子已经被作者于2019/12/7 8:52:31编辑过]
|
-- 作者:hopestarxia -- 发布时间:2019/12/7 9:46:00 -- 老师,接收的代码如下,那个复制不起来,您受累在命令里执行看一下,就能看到读取到的数据了。 数据里其实包含的就 inboundNo,,inboundDate,goodsSupplierNo,numbers,goodsNo,goodsCount,goodsPrice,goodsMoney,orderValue 而我的数据库下的SJB表里也是包含相同的字段,我想到接收的数据存入到数据表里 Dim hc As new HttpClient("http://qingyun.feiyang56.cn/fyhd//ifs/inbound_queryDetailList_resultAction.action") Dim jo As New JObject jo("userName") = "澜珊商贸" jo("userPass") = "123456" jo("startDate") = "2019-12-02 00:00:00" jo("endDate") = "2019-12-02 23:59:59" jo("orderNo") = "" jo("currentPage") = "1" jo("pageSize") = "100" Dim orderJson As String = jo.tostring() msgbox(orderJson ) hc.FormData.Add("param",orderJson ) Dim ret = hc.GetData msgbox(ret) ------------------------------ 以下为做的读取后存入语句,语句不能实现 Dim hc As new HttpClient("http://qingyun.feiyang56.cn/fyhd//ifs/inbound_queryDetailList_resultAction.action") Dim jo As New JObject jo("userName") = "澜珊商贸" jo("userPass") = "123456" jo("startDate") = "2019-12-02 00:00:00" jo("endDate") = "2019-12-02 23:59:59" jo("orderNo") = "" jo("currentPage") = "1" jo("pageSize") = "100" Dim orderJson As String =CompressJson(jo) msgbox(orderJson ) hc.FormData.Add("param",orderJson ) Dim ret = hc.GetData For Each ep As JToken In JArray.Parse(ret) Dim rr As Row=Tables("sjb").addnew() rr("inboundNo")=ep("inboundNo") rr("inboundDate")=ep("inboundDate") Next |
-- 作者:有点蓝 -- 发布时间:2019/12/7 10:03:00 -- 先看看帮助,或者百度一下,搞清楚JSON的结构到底是怎么样的:http://www.foxtable.com/mobilehelp/topics/0140.htm |
-- 作者:有点蓝 -- 发布时间:2019/12/7 10:41:00 -- Dim hc As new HttpClient("http://qingyun.feiyang56.cn/fyhd//ifs/inbound_queryDetailList_resultAction.action") Dim jo As New JObject jo("userName") = "澜珊商贸" jo("userPass") = "123456" jo("startDate") = "2019-12-02 00:00:00" jo("endDate") = "2019-12-02 23:59:59" jo("orderNo") = "" jo("currentPage") = "1" jo("pageSize") = "100" Dim orderJson As String = jo.tostring() \'msgbox(orderJson ) hc.FormData.Add("param",orderJson ) Dim ret = hc.GetData jo = JObject.Parse(ret) Dim jo2 As JObject = JObject.Parse(jo("resultObject")) For Each ep As JToken In jo2("list") Output.Show(ep("inboundNo")) \'Dim rr As Row=Tables("sjb").addnew() \'rr("inboundNo")=ep("inboundNo") \'rr("inboundDate")=ep("inboundDate") Next
|
-- 作者:hopestarxia -- 发布时间:2019/12/7 23:33:00 -- 谢谢老师! |