Foxtable(狐表)用户栏目专家坐堂 → 不重复导入


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

主题:不重复导入

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


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

请做一个具体的例子发上来测试。

 

不然,请看看这样合成条件 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&replyID=879031&ID=131505&skin=1

 


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


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

Dim book As NEW xls.book("C:\Users\dv rrxaI600 007\Downloads\新建文件夹\新建文件夹\现金银行.XLS")
Dim Sheet As xls.Sheet = BOOK.Sheets(0)
For i As Integer = 1 To Sheet.Rows.Count-1
    Dim b1 As String = sheet(i,1).text
    Dim b2 As String = sheet(i,2).text
    Dim b3 As String = sheet(i,3).text
    Dim b4 As String = sheet(i,4).text
    Dim b5 As String = sheet(i,5).text
    Dim b7 As String = sheet(i,7).text
    Dim b8 As String = sheet(i,8).text
    Dim filter As String = "1=1"
    If b1 = Nothing Then
        filter &= " and 类别名称 = '基本帐户'"
    Else
        filter &= " and 类别名称 = '"& b1 &"'"
    End If
   
    If b2 = Nothing Then
        filter &= " and 日期 is null"
    Else
        filter &= " and 日期 = #"& b2 &"#"
    End If
    If b3 = Nothing Then
        filter &= " and 摘要 is null"
    Else
        filter &= " and 摘要 = '"& b3 &"'"
    End If
    If b4 = Nothing Then
        filter &= " and 收入 is null"
    Else
        filter &= " and 收入 = '"& b4 &"'"
    End If
    If b5 = Nothing Then
        filter &= " and 支出 is null"
    Else
        filter &= " and 支出 = '"& b5 &"'"
    End If
   
    If b7 = Nothing Then
        filter &= " and 对方帐户 is null"
    Else
        filter &= " and 对方帐户 = '"& b7 &"'"
    End If
    If b8 = Nothing Then
        filter &= " and 会计年度 is null"
    Else
        filter &= " and 会计年度 = '"& b8 &"'"
    End If
    If DataTables("现金银行").find(filter) Is Nothing Then
        Dim dr As Row = Tables("现金银行").AddNew()
        dr("类别名称") = "基本帐户"
        dr("日期") = sheet(i,2).text
        dr("摘要") = sheet(i,3).text
        dr("收入") = sheet(i,4).text
        dr("支出") = sheet(i,5).text
        dr("对方帐户") = sheet(i,7).text
        dr("会计年度") = sheet(i,8).text
    End If
Next

 回到顶部