以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  获取企业微信审批单数据  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153410)

--  作者:13968559581
--  发布时间:2020/8/10 12:10:00
--  获取企业微信审批单数据
我代码这样的,但报错,什么原因

Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token={0}"
Dim hc As New HttpClient(CExp(ur,Functions.Execute("GetQYAccessTokensp")))
Dim jo As New JObject
jo("sp_no") =202007280001
图片点击可在新窗口打开查看此主题相关图片如下:898989.png
图片点击可在新窗口打开查看
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData())
If jo("errcode") = "0" Then
    Dim nms() As String = {"sp_no","sp_name","sp_status"}
   \'  Dim nms() As String = {"sp_no","sp_name","sp_status","template_id","apply_time","userid"}

    For Each jt As JToken In jo("info")
        Dim dr As DataRow = DataTables("企业微信审批单").AddNew()
        For Each nm As String In nms
            msgbox(nm)
            dr(nm) = jt(nm)
        Next
    Next
    DataTables("企业微信审批单").Save()
[此贴子已经被作者于2020/8/10 13:02:01编辑过]

--  作者:有点蓝
--  发布时间:2020/8/10 13:32:00
--  
json解析出错:http://www.foxtable.com/mobilehelp/topics/0140.htm

josn结果发上来看看
dim ret as string = hc.GetData()
output.show(ret)

--  作者:13968559581
--  发布时间:2020/8/10 13:42:00
--  

这样执行,提示
图片点击可在新窗口打开查看此主题相关图片如下:88888.png
图片点击可在新窗口打开查看
Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token={0}"
Dim hc As New HttpClient(CExp(ur,Functions.Execute("GetQYAccessTokensp")))
Dim jo As New JObject
jo("sp_no") ="202007280001"
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData())
Dim ret As String = hc.GetData()
  msgbox(ret)

--  作者:有点蓝
--  发布时间:2020/8/10 13:46:00
--  
hc.Content = jo.ToString()
Dim ret As String = hc.GetData()
  msgbox(ret)
jo = JObject.Parse(ret)

--  作者:13968559581
--  发布时间:2020/8/10 14:30:00
--  
你好,  msgbox(ret),这个数据能获取到,我现在感觉这里有问题
 For Each nm As String In nms
            dr(nm) = jt(nm)
  Next
,怎么写
Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token={0}"
Dim hc As New HttpClient(CExp(ur,Functions.Execute("GetQYAccessTokensp")))
Dim jo As New JObject
jo("sp_no") ="202007280001"
hc.Content = jo.ToString()
Dim ret As String = hc.GetData()
  msgbox(ret)
jo = JObject.Parse(ret)
If jo("errcode") = "0" Then
    Dim nms() As String = {"sp_no","sp_name"}
      For Each jt As JToken In jo("info")
      Dim dr As DataRow = DataTables("企业微信审批单").AddNew()
        For Each nm As String In nms
            dr(nm) = jt(nm)
        Next
    Next
    DataTables("企业微信审批单").Save()
Else
    MessageBox.Show(jo.ToString)
End If

--  作者:有点蓝
--  发布时间:2020/8/10 14:40:00
--  
josn结果发上来看看
dim ret as string = hc.GetData()
output.show(ret)

--  作者:13968559581
--  发布时间:2020/8/10 15:08:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:7777.png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2020/8/10 15:16:00
--  
If jo("errcode") = "0" Then
    Dim nms() As String = {"sp_no","sp_name"}
      Dim jo1 As JObject = jo("info")
      Dim dr As DataRow = DataTables("企业微信审批单").AddNew()
        For Each nm As String In nms
            dr(nm) = jo1(nm).tostring
        Next
    DataTables("企业微信审批单").Save()
Else
    MessageBox.Show(jo.ToString)
End If
[此贴子已经被作者于2020/8/10 15:16:23编辑过]

--  作者:13968559581
--  发布时间:2020/8/10 15:22:00
--  
你好,可以了
有jt ,jo这个语法的基础说明吗,我语法不懂哦,想学习一下

--  作者:有点蓝
--  发布时间:2020/8/10 15:23:00
--  
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=146030&skin=0