麻烦大家帮我看下,下面这段代码哪里出问题了,每次当这段代码运行的时候fotable就崩溃,系统自动关闭了~
If e.DataRow.IsNull("发表日期") And e.DataRow.IsNull("实际完成日期") Then
e.DataRow("检测用时")=Nothing
Else
Dim d1 As Date = e.DataRow("发表日期")
Dim d2 As Date = e.DataRow("实际完成日期")
If d1>d2
e.DataRow("检测用时") = 0
Else
Dim cnt As Integer = (d2-d1).TotalDays
For i As Integer = 1 To cnt
Dim d3 As Date = d1.adddays(i)
If d3.DayOfWeek = 0 OrElse d3.DayOfWeek = 6 Then '如果是星期天或者星期六
cnt = cnt - 1
End If
Next
e.DataRow("检测用时") = cnt + 1
End If
End If