以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  代码问题求帮助!  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=128968)

--  作者:lisheng1971
--  发布时间:2018/12/19 10:29:00
--  代码问题求帮助!

条件:“原技术资格等级”如果为空,则“参加工作时间”满12年即为合格,也就是“是否合格”为 TRUE,下面代码问题出在哪?

If e.DataRow("原技术资格等级") = "" AndAlso Cdate(e.DataRow("参加工作时间")).Year <= Date.Today.Year - 12 Then
                        e.DataRow("是否合格") = True
                    Else
                        e.DataRow("是否合格") = False
                    End If


--  作者:有点甜
--  发布时间:2018/12/19 11:33:00
--  

Dim d As Date = e.DataRow("参加工作时间")
Dim y As Integer = d.year
If format(d, "MMdd") <= Format(Date.Today, "MMdd") Then
    y = Date.Today.Year - y
Else
    y = Date.Today.Year - y -1
End If
If e.DataRow("原技术资格等级") = Nothing AndAlso y >= 12 Then
    e.DataRow("是否合格") = True
Else
    e.DataRow("是否合格") = False
End If