Foxtable(狐表)用户栏目专家坐堂 → 帮我看看哪里错了?


  共有2902人关注过本帖树形打印复制链接

主题:帮我看看哪里错了?

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


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
帮我看看哪里错了?  发帖心情 Post By:2021/3/22 14:50:00 [显示全部帖子]

Dim sa1 As String = "A01"
Dim fsc As String = "开piao数据"
Dim drU As DataRow
drU = DataTables("表C").Find("[执行编号] = '" & sa1 & "' And [分类] = '" & fsc & "'")
Dim dzml1 As String = drU("主文件夹目录")
Dim dzml2 As String = drU("次文件夹目录")
For Each f As String In FileSys.GetFiles(dzml2)
    If f.EndsWith(".log") Then
        Dim txt As String = FileSys.ReadAllText(f, Encoding.Default)
        Dim xmlDoc As New System.XML.XmlDocument
        xmlDoc.Loadxml(txt.Trim)
        Dim ndList  = xmlDoc.GetElementsByTagName("comment")
        For Each dr As object In ndlist
            Dim fpdm As String
            Dim fphm As String
            Dim ghdwmc As String
            Dim ghdwdzdh As String
            Dim ghdwsbh As String
            Dim ghdwyhzh As String
            Dim hjje As String
            Dim hjse As String
            Dim jshj As String
            Dim bz As String
            For i As Integer = 0 To ndList.count - 1
                If ndList(i).Item("fpdm") IsNot Nothing Then fpdm = ndList(i).Item("fpdm").InnerText
                If ndList(i).Item("fphm") IsNot Nothing Then fphm = ndList(i).Item("fphm").InnerText
                If ndList(i).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList(i).Item("ghdwmc").InnerText
                If ndList(i).Item("ghdwdzdh") IsNot Nothing Then ghdwdzdh = ndList(i).Item("ghdwdzdh").InnerText
                If ndList(i).Item("ghdwsbh") IsNot Nothing Then ghdwsbh = ndList(i).Item("ghdwsbh").InnerText
                If ndList(i).Item("ghdwyhzh") IsNot Nothing Then ghdwyhzh = ndList(i).Item("ghdwyhzh").InnerText
                If ndList(i).Item("hjje") IsNot Nothing Then hjje = ndList(i).Item("hjje").InnerText
                If ndList(i).Item("hjse") IsNot Nothing Then hjse = ndList(i).Item("hjse").InnerText
                If ndList(i).Item("jshj") IsNot Nothing Then jshj = ndList(i).Item("jshj").InnerText
                If ndList(i).Item("bz") IsNot Nothing Then bz = ndList(i).Item("bz").InnerText
            Next
            Dim ndList1  = xmlDoc.GetElementsByTagName("fyxm")(0).ChildNodes
            For i As Integer = 0 To ndList.count - 1
                Dim spmc As String = ndList1(i).Item("spmc").InnerText
                Dim ggxh As String = ndList1(i).Item("ggxh").InnerText
                Dim sl As String = ndList1(i).Item("sl").InnerText
                Dim se As String = ndList1(i).Item("se").InnerText
                Dim dw As String = ndList1(i).Item("dw").InnerText
                Dim spsl As String = ndList1(i).Item("spsl").InnerText
                Dim dj As String = ndList1(i).Item("dj").InnerText
                Dim je As String = ndList1(i).Item("je").InnerText
                Dim r As Row = Tables("表B").AddNew
                r("第一列") = fpdm
                r("第二列") = fphm
                r("第三列") = ghdwmc
                r("第四列") = spmc
                r("第五列") = ggxh
                r("第六列") = dw
                r("第七列") = spsl
                r("第八列") = dj
                r("第十列") = "str"
            Next
        Next
    End If
Next

图片点击可在新窗口打开查看此主题相关图片如下:01.jpg
图片点击可在新窗口打开查看
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:_2020-12-19.rar

这个代码应该怎么写啊



[此贴子已经被作者于2021/3/22 14:51:03编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/22 14:59:00 [显示全部帖子]

那有什么办法读取的时候去掉呢?

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/22 18:18:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:01.jpg
图片点击可在新窗口打开查看
现在变这样了

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 7:21:00 [显示全部帖子]

Dim sa1 As String = "A01"
Dim fsc As String = "开piao数据"
Dim drU As DataRow
drU = DataTables("表C").Find("[执行编号] = '" & sa1 & "' And [分类] = '" & fsc & "'")
Dim dzml1 As String = drU("主文件夹目录")
Dim dzml2 As String = drU("次文件夹目录")
For Each f As String In FileSys.GetFiles(dzml2)
    If f.EndsWith(".log") Then
        Dim txt As String = FileSys.ReadAllText(f, Encoding.Default)
        Dim idx As Integer = txt.IndexOf("<?xml version")
        Dim s2 As String = txt.SubString(idx)
        Dim sx As String = "s2"
        MessageBox.Show(s2)
        Dim xmlDoc As New System.XML.XmlDocument
        xmlDoc.Loadxml(s2)
        MessageBox.Show("0")
        Dim ndList  = xmlDoc.GetElementsByTagName("comment")
        For Each dr As object In ndlist
            Dim fpdm As String
            Dim fphm As String
            Dim ghdwmc As String
            Dim ghdwdzdh As String
            Dim ghdwsbh As String
            Dim ghdwyhzh As String
            Dim hjje As String
            Dim hjse As String
            Dim jshj As String
            Dim bz As String
            For i As Integer = 0 To ndList.count - 1
                If ndList(i).Item("fpdm") IsNot Nothing Then fpdm = ndList(i).Item("fpdm").InnerText
                If ndList(i).Item("fphm") IsNot Nothing Then fphm = ndList(i).Item("fphm").InnerText
                If ndList(i).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList(i).Item("ghdwmc").InnerText
                If ndList(i).Item("ghdwdzdh") IsNot Nothing Then ghdwdzdh = ndList(i).Item("ghdwdzdh").InnerText
                If ndList(i).Item("ghdwsbh") IsNot Nothing Then ghdwsbh = ndList(i).Item("ghdwsbh").InnerText
                If ndList(i).Item("ghdwyhzh") IsNot Nothing Then ghdwyhzh = ndList(i).Item("ghdwyhzh").InnerText
                If ndList(i).Item("hjje") IsNot Nothing Then hjje = ndList(i).Item("hjje").InnerText
                If ndList(i).Item("hjse") IsNot Nothing Then hjse = ndList(i).Item("hjse").InnerText
                If ndList(i).Item("jshj") IsNot Nothing Then jshj = ndList(i).Item("jshj").InnerText
                If ndList(i).Item("bz") IsNot Nothing Then bz = ndList(i).Item("bz").InnerText
            Next
            Dim ndList1  = xmlDoc.GetElementsByTagName("fyxm")(0).ChildNodes
            For i As Integer = 0 To ndList.count - 1
                Dim spmc As String = ndList1(i).Item("spmc").InnerText
                Dim ggxh As String = ndList1(i).Item("ggxh").InnerText
                Dim sl As String = ndList1(i).Item("sl").InnerText
                Dim se As String = ndList1(i).Item("se").InnerText
                Dim dw As String = ndList1(i).Item("dw").InnerText
                Dim spsl As String = ndList1(i).Item("spsl").InnerText
                Dim dj As String = ndList1(i).Item("dj").InnerText
                Dim je As String = ndList1(i).Item("je").InnerText
                Dim r As Row = Tables("表B").AddNew
                r("第一列") = fpdm
                r("第二列") = fphm
                r("第三列") = ghdwmc
                r("第四列") = spmc
                r("第五列") = ggxh
                r("第六列") = dw
                r("第七列") = spsl
                r("第八列") = dj
                r("第十列") = "str"
            Next
        Next
    End If
Next
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:_2020-12-19.rar
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:xml项目.foxdb

搞不来了,请大神帮忙改改吧



[此贴子已经被作者于2021/3/23 8:31:51编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 9:57:00 [显示全部帖子]

Dim sa1 As String = "A01"
Dim fsc As String = "开piao数据"
Dim drU As DataRow
drU = DataTables("表C").Find("[执行编号] = '" & sa1 & "' And [分类] = '" & fsc & "'")
Dim dzml1 As String = drU("主文件夹目录")
Dim dzml2 As String = drU("次文件夹目录")
For Each f As String In FileSys.GetFiles(dzml2)
    If f.EndsWith(".log") Then
        Dim txt As String = FileSys.ReadAllText(f, Encoding.Default)
        Dim idx As Integer = txt.IndexOf("<?xml version")
        Dim idx2 As Integer = txt.IndexOf("</business>",idx)
        Do While idx > -1 And idx2 > -1
            Dim s2 As String = txt.SubString(idx,idx2-idx+11)
            idx  = txt.IndexOf("<?xml version",idx2)
            If idx > -1
                idx2  = txt.IndexOf("</business>",idx)
            Else
                idx2=-1
            End If
            Dim xmlDoc As New System.XML.XmlDocument
            xmlDoc.Loadxml(s2)
            Dim ndList  = xmlDoc.GetElementsByTagName("comment")
            For Each dr As object In ndlist
                Dim fpdm As String
                Dim fphm As String
                Dim ghdwmc As String
                Dim ghdwdzdh As String
                Dim ghdwsbh As String
                Dim ghdwyhzh As String
                Dim hjje As String
                Dim hjse As String
                Dim jshj As String
                Dim bz As String
                For i As Integer = 0 To ndList.count - 1
                    If ndList(i).Item("fpdm") IsNot Nothing Then fpdm = ndList(i).Item("fpdm").InnerText
                    If ndList(i).Item("fphm") IsNot Nothing Then fphm = ndList(i).Item("fphm").InnerText
                    If ndList(i).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList(i).Item("ghdwmc").InnerText
                    If ndList(i).Item("ghdwdzdh") IsNot Nothing Then ghdwdzdh = ndList(i).Item("ghdwdzdh").InnerText
                    If ndList(i).Item("ghdwsbh") IsNot Nothing Then ghdwsbh = ndList(i).Item("ghdwsbh").InnerText
                    If ndList(i).Item("ghdwyhzh") IsNot Nothing Then ghdwyhzh = ndList(i).Item("ghdwyhzh").InnerText
                    If ndList(i).Item("hjje") IsNot Nothing Then hjje = ndList(i).Item("hjje").InnerText
                    If ndList(i).Item("hjse") IsNot Nothing Then hjse = ndList(i).Item("hjse").InnerText
                    If ndList(i).Item("jshj") IsNot Nothing Then jshj = ndList(i).Item("jshj").InnerText
                    If ndList(i).Item("bz") IsNot Nothing Then bz = ndList(i).Item("bz").InnerText
                Next
                Dim ndList1  = xmlDoc.GetElementsByTagName("fyxm")(0).ChildNodes
                For i As Integer = 0 To ndList.count - 1
                    Dim spmc As String = ndList1(i).Item("spmc").InnerText
                    Dim ggxh As String = ndList1(i).Item("ggxh").InnerText
                    Dim sl As String = ndList1(i).Item("sl").InnerText
                    Dim se As String = ndList1(i).Item("se").InnerText
                    Dim dw As String = ndList1(i).Item("dw").InnerText
                    Dim spsl As String = ndList1(i).Item("spsl").InnerText
                    Dim dj As String = ndList1(i).Item("dj").InnerText
                    Dim je As String = ndList1(i).Item("je").InnerText
                    Dim r As Row = Tables("表B").AddNew
                    r("第一列") = fpdm
                    r("第二列") = fphm
                    r("第三列") = ghdwmc
                    r("第四列") = spmc
                    r("第五列") = ggxh
                    r("第六列") = dw
                    r("第七列") = spsl
                    r("第八列") = dj
                    r("第十列") = "str"
                Next
            Next
        Loop
    End If
Next

错误是没有了,但是没有将数据写入表中,这是为什么?

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 10:59:00 [显示全部帖子]


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

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

导入会出现错误
而且里面的<fpdm>3100203130</fpdm><fphm>42283849</fphm>等都不能导入。请帮我改改代码

Dim sa1 As String = "A01"
Dim fsc As String = "开piao数据"
Dim drU As DataRow
drU = DataTables("表C").Find("[执行编号] = '" & sa1 & "' And [分类] = '" & fsc & "'")
Dim dzml1 As String = drU("主文件夹目录")
Dim dzml2 As String = drU("次文件夹目录")
For Each f As String In FileSys.GetFiles(dzml2)
    If f.EndsWith(".log") Then
        Dim txt As String = FileSys.ReadAllText(f, Encoding.Default)
        Dim idx As Integer = txt.IndexOf("<?xml version")
        Dim idx2 As Integer = txt.IndexOf("</business>",idx)
        Do While idx > -1 And idx2 > -1
            Dim s2 As String = txt.SubString(idx,idx2-idx+11)
            idx  = txt.IndexOf("<?xml version",idx2)
            If idx > -1
                idx2  = txt.IndexOf("</business>",idx)
            Else
                idx2=-1
            End If
            Dim xmlDoc As New System.XML.XmlDocument
            xmlDoc.Loadxml(s2)
            'Dim fpdm As String
            'Dim fphm As String
            'Dim ghdwmc As String            
            'Dim ghdwdzdh As String
            'Dim ghdwsbh As String
            'Dim ghdwyhzh As String
            'Dim hjje As String
            'Dim hjse As String
            'Dim jshj As String
            'Dim bz As String
            'Dim ndList1  = xmlDoc.GetElementsByTagName("</business")
            'For s As Integer = 0 To ndList1.count - 1
                'If ndList1(s).Item("fpdm") IsNot Nothing Then fpdm = ndList1(s).Item("fpdm").InnerText
                'If ndList1(s).Item("fphm") IsNot Nothing Then fphm = ndList1(s).Item("fphm").InnerText
                'If ndList1(s).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList1(s).Item("ghdwmc").InnerText
                Dim ndList  = xmlDoc.GetElementsByTagName("fyxm")(0).ChildNodes
                For i As Integer = 0 To ndList.count - 1
                    Dim spmc As String = ndList(i).Item("spmc").InnerText
                    Dim ggxh As String = ndList(i).Item("ggxh").InnerText
                    Dim sl As String = ndList(i).Item("sl").InnerText
                    Dim se As String = ndList(i).Item("se").InnerText
                    Dim dw As String = ndList(i).Item("dw").InnerText
                    Dim spsl As String = ndList(i).Item("spsl").InnerText
                    Dim dj As String = ndList(i).Item("dj").InnerText
                    Dim je As String = ndList(i).Item("je").InnerText
                    Dim r As Row = Tables("表B").AddNew
                    'r("第一列") = fpdm
                    'r("第二列") = fphm
                    'r("第三列") = ghdwmc
                    r("第四列") = spmc
                    r("第五列") = ggxh
                    r("第六列") = dw
                    r("第七列") = spsl
                    r("第八列") = dj
                    r("第十列") = "str"
                'Next
            Next
        Loop
    End If
Next
[此贴子已经被作者于2021/3/23 10:59:55编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 11:06:00 [显示全部帖子]

能不能帮帮忙,这个真搞不懂?

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 11:53:00 [显示全部帖子]


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


到这里出错

            Dim fpdm As String
            Dim fphm As String
            Dim ghdwmc As String
            Dim ghdwdzdh As String
            Dim ghdwsbh As String
            Dim ghdwyhzh As String
            Dim hjje As String
            Dim hjse As String
            Dim jshj As String
            Dim bz As String
            Dim ndList1  = xmlDoc.GetElementsByTagName("</business")
            For s As Integer = 0 To ndList1.count - 1
                If ndList1(s).Item("fpdm") IsNot Nothing Then fpdm = ndList1(s).Item("fpdm").InnerText
                If ndList1(s).Item("fphm") IsNot Nothing Then fphm = ndList1(s).Item("fphm").InnerText
                If ndList1(s).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList1(s).Item("ghdwmc").InnerText
            Next
            Dim ndList  = xmlDoc.GetElementsByTagName("fyxm")(0).ChildNodes
            For i As Integer = 0 To ndList.count - 1
                Dim spmc As String = ndList(i).Item("spmc").InnerText
                Dim ggxh As String = ndList(i).Item("ggxh").InnerText
                Dim sl As String = ndList(i).Item("sl").InnerText
                Dim se As String = ndList(i).Item("se").InnerText
                Dim dw As String = ndList(i).Item("dw").InnerText
                Dim spsl As String = ndList(i).Item("spsl").InnerText
                Dim dj As String = ndList(i).Item("dj").InnerText
                Dim je As String = ndList(i).Item("je").InnerText
                Dim r As Row = Tables("表B").AddNew
                r("第一列") = fpdm
                r("第二列") = fphm
                r("第三列") = ghdwmc
                r("第四列") = spmc
                r("第五列") = ggxh
                r("第六列") = dw
                r("第七列") = spsl
                r("第八列") = dj
                r("第十列") = "str" 
            Next
好像是因为没有字段

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 14:36:00 [显示全部帖子]

Dim sa1 As String = "A01"
Dim fsc As String = "开piao数据"
Dim drU As DataRow
drU = DataTables("表C").Find("[执行编号] = '" & sa1 & "' And [分类] = '" & fsc & "'")
Dim dzml1 As String = drU("主文件夹目录")
Dim dzml2 As String = drU("次文件夹目录")
For Each f As String In FileSys.GetFiles(dzml2)
    If f.EndsWith(".log") Then
        Dim txt As String = FileSys.ReadAllText(f, Encoding.Default)
        Dim idx As Integer = txt.IndexOf("<?xml version")
        Dim idx2 As Integer = txt.IndexOf("</business>",idx)
        Do While idx > -1 And idx2 > -1
            Dim s2 As String = txt.SubString(idx,idx2-idx+11)
            idx  = txt.IndexOf("<?xml version",idx2)
            If idx > -1
                idx2  = txt.IndexOf("</business>",idx)
            Else
                idx2=-1
            End If
            Dim xmlDoc As New System.XML.XmlDocument
            xmlDoc.Loadxml(s2)
            Dim ndList1  = xmlDoc.GetElementsByTagName("returndata")
            If ndList1.count > 0
                Dim fpdm As String
                Dim fphm As String
                Dim ghdwmc As String
                Dim ghdwdzdh As String
                Dim ghdwsbh As String
                Dim ghdwyhzh As String
                Dim hjje As String
                Dim hjse As String
                Dim jshj As String
                Dim bz As String
                For s As Integer = 0 To ndList1.count - 1
                    If ndList1(s).Item("fpdm") IsNot Nothing Then fpdm = ndList1(s).Item("fpdm").InnerText
                    If ndList1(s).Item("fphm") IsNot Nothing Then fphm = ndList1(s).Item("fphm").InnerText
                    If ndList1(s).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList1(s).Item("ghdwmc").InnerText
                    Dim ndList2  = xmlDoc.GetElementsByTagName("fyxm")
                    Dim ndList   = ndList2(0).ChildNodes
                    For i As Integer = 0 To ndList.count - 1
                        Dim spmc As String = ndList(i).Item("spmc").InnerText
                        Dim ggxh As String = ndList(i).Item("ggxh").InnerText
                        Dim sl As String = ndList(i).Item("sl").InnerText
                        Dim se As String = ndList(i).Item("se").InnerText
                        Dim dw As String = ndList(i).Item("dw").InnerText
                        Dim spsl As String = ndList(i).Item("spsl").InnerText
                        Dim dj As String = ndList(i).Item("dj").InnerText
                        Dim je As String = ndList(i).Item("je").InnerText
                        Dim r As Row = Tables("表B").AddNew
                        r("第一列") = fpdm
                        r("第二列") = fphm
                        r("第三列") = ghdwmc
                        r("第四列") = spmc
                        r("第五列") = ggxh
                        r("第六列") = dw
                        r("第七列") = spsl
                        r("第八列") = dj
                        r("第十列") = "str"
                    Next
                Next
            End If
        Loop
    End If
Next

怎么红色部分提取不到值呢?

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2943 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2021/3/23 14:50:00 [显示全部帖子]

那怎么搞?有办法吗?

 回到顶部
总数 17 1 2 下一页