以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何选择表中的重复记录  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=39785)

--  作者:malavazos
--  发布时间:2013/9/1 20:39:00
--  如何选择表中的重复记录
请教,如何将表中的重复记录筛选出来并去除?谢谢
--  作者:有点甜
--  发布时间:2013/9/1 21:09:00
--  
 删除的参考代码

Dim t As Table =  Tables("表A")
t.Select(t.Rowsel,t.cols("第一列").Index)
syscmd.Filter.ShowRedundantValues
For i As Integer = t.Rows.Count -1 To 0 Step -1
    t.rows(i).Delete
Next
t.Datable.Save
t.filter = ""

 或者正常的删除
Dim i As Integer
For i  = DataTables("表A").DataRows.Count-1 To 0 Step -1
    Dim dr As DataRow = DataTables("表A").DataRows(i)
    Dim dr2 As DataRow = DataTables("表A").Find("第一列=\'" & dr("第一列") & "\' and 第二列=\'" & dr("第二列") & "\' and _Identify <> " & dr("_Identify"))
    If dr2 IsNot Nothing Then
        dr2.Delete
    End If
Next