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


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

主题:导入去重复

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


加好友 发短信
等级:小狐 帖子:376 积分:4189 威望:0 精华:0 注册:2008/9/1 14:18:00
导入去重复  发帖心情 Post By:2012/8/19 10:56:00 [显示全部帖子]

Dim Book As New XLS.Book(ProjectPath & "资料.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("资料").StopRedraw()
Dim Filter As String
Dim nms() As String = {"类别","品名","规格","单位"}
For n As Integer = 1 To Sheet.Rows.Count - 1
    Filter = ""
    For m As Integer = 0 To nms.Length - 1
        If m > 0 Then
            Filter = Filter & " And "
        End If
        Filter = Filter & nms(m) & " = '" & sheet(n,m).Value & "'"
    Next
    If DataTables("资料").Find(Filter) Is Nothing Then
        Dim r As Row = Tables("资料").AddNew()
        For m As Integer = 0 To nms.Length - 1
            r(nms(m)) = Sheet(n,m).Value
        Next
    End If
Next
Tables("资料").ResumeRedraw()

 回到顶部