Select Case e.DataCol.Name
Case "名称","年份","月份","数量"
If e.DataRow.IsNull("名称")=False AndAlso e.DataRow.IsNull("年份")=False AndAlso e.DataRow.IsNull("月份")=False AndAlso e.DataRow.IsNull("数量")=False Then
Dim drr As DataRow = DataTables("表B").Find("名称='" & e.DataRow("名称") & "' and 年份='" & e.DataRow("年份") & "' and 月份='" & e.DataRow("月份") & "' and 数量='" & e.DataRow("数量") & "'")
If drr IsNot Nothing Then
drr("名称")=e.DataRow("名称")
drr("年份")=e.DataRow("年份")
drr("月份")=e.DataRow("月份")
drr("数量")=e.DataRow("数量")
Else
Dim dr As DataRow = DataTables("表B").AddNew
dr("名称")=e.DataRow("名称")
dr("年份")=e.DataRow("年份")
dr("月份")=e.DataRow("月份")
dr("数量")=e.DataRow("数量")
End If
End If
End Select
帮你把代码贴出来了