Dim s As String
dim filter as string
Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
dim idx as integer = 0
For Each Index As Integer In l.CheckedIndices
dim c as string = l.Items(Index)
s = s & "|" & c
if filter > "" then filter = filter & " and "
if dataTables(Vars("btname")).datacols(c).IsNumeric
filter = filter & c & "={" & idx & "}"
elseif dataTables(Vars("btname")).datacols(c).IsDate
filter = filter & c & "=#{" & idx & "}#"
else
filter = filter & c & "='{" & idx & "}'"
end if
idx += 1
Next
s = s.trim("|")
dim dr as datarow
生成"比对表"的代码
for each sr() as string in dataTables(Vars("btname")).GetValues(s)
dr = dataTables(Vars("btname")).find(CExp(filter,sr))
if dr isnot nothing then
Dim r As Row = Tables("比对表").addnew
For Each dc As Col In Tables(Vars("btname")).Cols
r(dc.name) = dr(dc.name)
Next
end if
next