Foxtable(狐表)用户栏目专家坐堂 → 请教打考机导出文本文件数据导入操作代码


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

主题:请教打考机导出文本文件数据导入操作代码

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110784 积分:563852 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/10/23 20:49:00 [显示全部帖子]

参考:http://www.foxtable.com/webhelp/topics/2629.htm,比如

Dim dlg As New OpenFileDialog
dlg.Filter = "文本文件|*.txt"
'Tables("表A").StopRedraw
If dlg.ShowDialog = DialogResult.OK Then
    Dim strs As String = FileSys.ReadAllText(dlg.FileName, Encoding.Default)
    strs = strs.Replace(vblf, "")
    Dim rs() As String = strs.Split(vbcr)
    For i As Integer = 1 To rs.Length - 2
        Dim cs() As String = rs(i).Split(" ")
        If cs.Length = 6 Then
            'Dim dr As DataRow = DataTables("表A").Addnew()
            Dim s As String = cs(0) & " " & cs(1)
            Dim ss() As String = s.Split("=")
            'dr(ss(0)) = ss(1).Trim("""")
            Output.Show(ss(0) & "," & ss(1).Trim(""""))
            For j As Integer = 2 To cs.Length - 1
                Dim c1 As String = cs(j)
                If c1.Trim() = "" Then Continue For
                ss = c1.Split("=")
                Output.Show(ss(0) & "," & ss(1).Trim(""""))
                'dr(ss(0)) = ss(1).Trim("""")
            Next
        End If
    Next
End If
'Tables("表A").ResumeRedraw

 回到顶部