Foxtable(狐表)用户栏目专家坐堂 → [求助]有关TXT文本文件导入到表的问题。


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

主题:[求助]有关TXT文本文件导入到表的问题。

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/10/7 10:54:00 [显示全部帖子]

Dim dlg As new OpenFileDialog
dlg.Filter = "文本文件|*.txt"

If dlg.ShowDialog = DialogResult.OK Then
    Dim strs As String = FileSys.ReadAllText(dlg.FileName)
    strs = strs.Replace(vblf,"")
    Dim rs() As String = strs.Split(vbcr)
    Dim dr As DataRow = DataTables("表A").Addnew()
    For i As Integer = 0 To rs.Length - 1
        Dim cs() As String = rs(i).Split(" ")
        Dim cname As String = ""
        For Each s As String In cs
            If s > "" Then
                If cname = "" Then
                    cname = s
                Else
                    dr(cname) = s
                    exit for
                End If
            End If
        Next
    Next
End If


 回到顶部