Foxtable(狐表)用户栏目专家坐堂 → 帮忙看下怎么判断不重复导入


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

主题:帮忙看下怎么判断不重复导入

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/18 20:17:00 [显示全部帖子]

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

If dlg.ShowDialog = DialogResult.OK Then
    Dim strs As String = FileSys.ReadAllText(dlg.FileName,Encoding.Default)
    Dim rs() As String = strs.Split(vbcrlf)    'txt的总行数
    Dim k2 As String = rs(2).trim
    For i As Integer = 1  To  rs.Length - 2   '从第2行开始读取
        Dim cs() As String = rs(i).Split("^")  '判断总列数
        Dim cs9 As Double = val(cs(9).trim.Replace(",", ""))
        Dim cs10 As Double = val(cs(10).trim.Replace(",", ""))
        Dim dd As DataRow = DataTables("表A").Find("交易日期 = #" & cs(1).trim & "# And  收入 = " & cs9 & " And 支出 = " & cs10 & "")
       
        If dd Is  Nothing Then
            Dim dr As DataRow = DataTables("表A").Addnew()
            For j As Integer = 0 To cs.Length -1
                dr("交易日期") = cs(1).trim
                dr("收入") = cs9
                dr("支出") = cs10
            Next
        End If
    Next
End If


 回到顶部