Dim lst As New List(of String) Dim rst As New List(of DataRow ) Dim Val As String For each dr As DataRow in DataTables("表A").DataRows if dr.IsNull("第一列") = False Andalso lst.Contains(dr("第一列")) = False lst.Add(dr("第一列")) val = "" For Each dr2 As DataRow in DataTables("表A").Select("第一列 = '" & dr("第一列") & "'" ) val = val & dr2("第二列") & "," Next dr("第二列") = val.trim("'") Else rst.Add(dr) End If Next For each dr As DataRow in rst dr.Delete Next