Dim dt1 As DataTable = DataTables("表A") Dim dt2 As DataTable = DataTables("表B") For Each dr As DataRow In dt1.Select("") Dim ls1 As new List(Of String) ls1.AddRange(dr("第二列").split(",")) Dim ls2 As new List(Of String) ls2.AddRange(dr("第三列").split(",")) If ls1.count > ls2.count Then Dim s As String = ls2(ls2.count-1) For i As Integer = ls2.count+1 To ls1.count ls2.add(s) Next Else Dim s As String = ls1(ls1.count-1) For i As Integer = ls1.count+1 To ls2.count ls1.add(s) Next End If For i As Integer = 0 To ls1.count-1 Dim ndr As DataRow = dt2.AddNew ndr("第一列") = dr("第一列") ndr("第二列") = ls1(i) ndr("第三列") = ls2(i) Next Next
|