Dim s As String
Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
For Each Index As Integer In l.CheckedIndices
s = s & "," & l.Items(Index)
Next
s = s.trim(",")
Dim cs As String = s
Dim idx As String = ""
Dim lst As new List(of String)
Dim flag As Boolean
Dim s1 As String = vars("不为空字段") & " is not null"
Dim drs As List(Of DataRow) = DataTables(Vars("btname")).Select(s1, cs)
Dim pdr As DataRow = drs(0)
Dim dr As DataRow
For i As Integer = 1 To drs.count -1
dr = drs(i)
flag = False
For Each c As String In cs.split(",")
If pdr(c) = dr(c) Then
flag = True
Exit For
End If
Next
If flag = False Then
If lst.Contains(pdr("_Identify")) = False
lst.add( pdr("_Identify") )
End If
lst.add( dr("_Identify") )
End If
pdr = dr
Next
If lst.count > 0 Then
idx = String.Join(",",lst.ToArray)
Dim s2 As String = s1 & " And _Identify not In (" & idx.trim(",") & ")"
Tables(Vars("btname")).filter = s2
Dim dtb As New DataTableBuilder("比对表")
Dim cnt As Integer = DataTables(Vars("btname")).DataCols.Count
Dim nms(cnt-1) As String
For i As Integer = 0 To cnt-1
nms(i) = DataTables(Vars("btname")).DataCols(i).name
dtb.AddDef(nms(i), Gettype(String), 255)
Next
dtb.Build()
Dim tb3 As WinForm.Table = e.Form.Controls("Table3")
tb3.Table.DataSource = DataTables("比对表")
tb3.Table.AutoSizeCols() '自适应列宽
For Each a1 As Row In Tables(Vars("btname")).rows
If a1 IsNot Nothing Then
Dim r As Row = Tables("比对表").addnew
For Each dc As Col In Tables(Vars("btname")).Cols
r(dc.name) = a1(dc.name)
Next
End If
Next
Else
MessageBox.Show("没有重复数据!")
End If