For Each dr1 As DataRow In DataTables("单位系数").DataRows For i As Integer = 1 To 12 If dr1.IsNull("部门") Then dr1("月系数_" & i) = Nothing Else Dim pr As Double = DataTables("个人数据").Compute("Sum(系数_" & i & ")","[部门_" & i & "] ='" & dr1("部门") & "'") dr1("月系数_" & i) = pr End If Next Next