也可一个按钮两用:
'''
Dim T As String
Dim Da As DataTable = DataTables("资料")
If Da.DataCols.Contains("重复") = False Then
Da.DataCols.Add("重复",GetType(Boolean))
End If
if Da.DataCols("重复").Caption = "不重复" then
For Each dr As DataRow in Da.Select("[身份证号码] Is Not Null")
T = "[身份证号码] ='" & dr("身份证号码") & "'"
If Da.Compute("Count(身份证号码)",T) >1 Then
dr("重复") = True
Else
dr("重复") = False
End If
Next
Da.DataCols("重复").Caption = "重复"
Else
Dim Ps As List(Of String)
Ps = Da.GetUniqueValues("[身份证号码] Is Not Null","身份证号码")
For Each dr As DataRow in Da.DataRows
dr("重复") = False
Next
For i As Integer = 0 To Ps.Count-1
T ="身份证号码 = '" & Ps(i) & "'"
Da.Find(T)("重复") = True
Next
Da.DataCols("重复").Caption = "不重复"
End if
Tables("资料").BuildHeader()
Tables("资料").Filter = "[重复] = True"
Tables("资料").Sort = "身份证号码"
[此贴子已经被作者于2008-12-12 18:46:57编辑过]