Dim dic As new Dictionary(of String, Integer)
For Each r As DataRow In e.DataTable.DataRows
For Each cname As String in "第一列,第二列,第三列".split(",")
If r.Isnull(cname) = False Then
If dic.ContainsKey(r(cname)) = False Then
dic.Add(r(cname), 1)
Else
dic(r(cname)) += 1
End If
End If
Next
Next
For Each key As String In dic.Keys
Dim fdr As DataRow = DataTables("表B").find("第一列 = '" & key & "'")
If fdr Is Nothing Then
fdr = DataTables("表B").addnew
fdr("第一列") = key
End If
fdr("第三列") = dic(key)
Next