Dim bm As String = "部门5" Dim cs() As String = {"数据1", "数据2", "数据3"} Dim dt As DataTable = DataTables("表B") For Each dr As DataRow In dt.Select("部门 = '" & bm & "'") For Each c As String In cs dr(c) = dt.Compute("sum(" & c & ")", "部门 in ('部门1', '部门2', '部门3', '部门4') And 序号 = '" & dr("序号") & "'") Next Next