以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]datachanged代码部分没运行  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=134180)

--  作者:天一生水
--  发布时间:2019/4/29 10:27:00
--  [求助]datachanged代码部分没运行

datachanged代码部分没运行,代码如下:

 

Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "快递详单"
        dr("快递详情") = ""
        Dim jo As JObject = Jobject.Parse(dr("快递详单"))
        For Each jt As JToken In jo("traces")
            If jo("traces") IsNot Nothing Then
                dr("快递详情") = dr("快递详情") & (jt("acceptTime").ToString & " | " & jt("acceptAddress").ToString & " | " & jt("remark").ToString) & vbcrlf
            Else
                dr("快递详情") = "过期或无此订单"

            End If
        Next
End Select
 

 


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

--  作者:有点甜
--  发布时间:2019/4/29 12:44:00
--  

Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "快递详单"
        dr("快递详情") = ""
        Dim jo As JObject = Jobject.Parse(dr("快递详单"))
        Dim ja As JArray = Jarray.Parse(("traces"))
        If ja.count > 0 Then
            For Each jt As JToken In jo("traces")
                dr("快递详情") = dr("快递详情") & (jt("acceptTime").ToString & " | " & jt("acceptAddress").ToString & " | " & jt("remark").ToString) & vbcrlf
            Next
        Else
            dr("快递详情") = "过期或无此订单"
        End If
       
End Select

--  作者:天一生水
--  发布时间:2019/4/29 13:15:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:360截图20190429131053050.jpg
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2019/4/29 13:21:00
--  

实例发上来测试。

 

Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "快递详单"
        If dr("快递详单") > "" Then
            dr("快递详情") = ""
            Dim jo As JObject = Jobject.Parse(dr("快递详单"))
            Dim ja As JArray = Jarray.Parse(("traces"))
            If ja.count > 0 Then
                For Each jt As JToken In jo("traces")
                    dr("快递详情") = dr("快递详情") & (jt("acceptTime").ToString & " | " & jt("acceptAddress").ToString & " | " & jt("remark").ToString) & vbcrlf
                Next
            Else
                dr("快递详情") = "过期或无此订单"
            End If
        End If
End Select


--  作者:天一生水
--  发布时间:2019/4/29 13:31:00
--  

谢谢老师!

请看实例:

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:ems查询.table


--  作者:有点甜
--  发布时间:2019/4/29 15:01:00
--  

Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "快递详单"
        If dr("快递详单") > "" Then
            Dim jo As JObject = Jobject.Parse(dr("快递详单"))
            Dim ja As JArray = jo("traces")
            Dim str = ""
            If ja.count > 0 Then
                For Each jt As JToken In jo("traces")
                    str &= (jt("acceptTime").ToString & " | " & jt("acceptAddress").ToString & " | " & jt("remark").ToString) & vbcrlf
                Next
                dr("快递详情") = str
            Else
                dr("快递详情") = "过期或无此订单"
            End If
        End If
End Select