各位老师:为什么我写了两段代码,表面看执行效果一致,但只有代码一好用呢?写了内容就记录,清除内容记录消失,而代码二就不行呢?
初学者求教。
代码一(好用)如果部门主管填写审批意见,就记录审批人和审批时间,如果没有内容,审批记录为空
----------------------------------------
If e.DataCol.Name = "审批内容_部门主管意见" Then
If e.DataRow.IsNull("审批内容_部门主管意见") Then
e.DataRow("审批内容_部门主管审批记录") = Nothing
Else
e.DataRow("审批内容_部门主管审批记录") = user.name & "\" & Date.now
End If
End If
‘----------------------------
代码二(不好用)如果部门主管填写过审批意见就记录审批人和审批时间,否则记录就为空
If e.DataCol.Name = "审批内容_部门主管意见" Then
If e.DataRow("审批内容_部门主管意见") IsNot Nothing Then
e.DataRow("审批内容_部门主管审批记录") = user.name & "\" & Date.now
Else
e.DataRow("审批内容_部门主管审批记录") = Nothing
End If
End If