逻辑问题,例如这一段:
Select Case e.DataCol.name
Case "入职日期","离职日期"
If e.DataRow.IsNull("入职日期") Then
e.DataRow("服务天数") = Nothing
Else If e.DataRow.IsNull("出生日期") = False Then
Dim tl As TimeSpan = Date.today - CDate(e.DataRow("出生日期"))
e.DataRow("年龄") = (Math.Round(tl.TotalDays)/365)
If e.DataRow.Isnull("离职日期") Then
Dim tp As TimeSpan = Date.today - CDate(e.DataRow("入职日期"))
e.DataRow("服务天数") = Math.Round(tp.TotalDays)
Else
Dim tt As TimeSpan = cdate(e.DataRow("离职日期")) - cdate(e.DataRow("入职日期"))
e.DataRow("服务天数") = math.round(tt.Totaldays)
End If
End If
End Select
应该改为:
Select Case e.DataCol.name
Case "入职日期","离职日期"
If e.DataRow.IsNull("入职日期") Then
e.DataRow("服务天数") = Nothing
Else
If e.DataRow.Isnull("离职日期") Then
Dim tp As TimeSpan = Date.today - CDate(e.DataRow("入职日期"))
e.DataRow("服务天数") = Math.Round(tp.TotalDays)
Else
Dim tt As TimeSpan = cdate(e.DataRow("离职日期")) - cdate(e.DataRow("入职日期"))
e.DataRow("服务天数") = math.round(tt.Totaldays)
End If
End If
If e.DataRow.IsNull("出生日期") = False Then
Dim tl As TimeSpan = Date.today - CDate(e.DataRow("出生日期"))
e.DataRow("年龄") = (Math.Round(tl.TotalDays)/365)
End If
End Select