例如:
Dim dr As DataRow = e.DataRow Dim dt As DataTable =DataTables("加班人员表") If e.DataCol.Name = "月份" OrElse e.DataCol.Name = "姓名" Then If e.DataRow.IsNull("月份") OrElse e.DataRow.IsNull("姓名") Then e.DataRow("正常工作日加班_小时") = Nothing '...清空其他计算字段 Else e.DataRow("正常工作日加班_小时") = dt.Compute("Sum(合计加班时间)","[月份] = '" & dr("月份") & "' And [实际加班人员姓名] = '" & dr("姓名") & "'") '...计算其他字段 End if End If
|