以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 精简代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=95560) |
-- 作者:一笑 -- 发布时间:2017/1/23 16:06:00 -- 精简代码 在表事件的DataColChanged写入如下代码,求精简,谢谢! Select Case e.DataCol.name Case "版次","修订日期","批准日期","培训日期","生效日期","发布日期" Dim dr As DataRow = e.DataRow If dr.IsNull("版次") = False And dr.IsNull("修订日期") = False And dr.IsNull("批准日期") = False And dr.IsNull("培训日期") = False And dr.IsNull("生效日期") = False And dr.IsNull("发布日期") = False Then dr("报备人") = _username dr("报备日期") = dt End If End Select |
-- 作者:有点蓝 -- 发布时间:2017/1/23 16:18:00 -- 精简不了 |
-- 作者:有点色 -- 发布时间:2017/1/24 2:08:00 -- Dim dcs As String() = {"版次","修订日期","批准日期","培训日期","生效日期","发布日期"} Dim hasnull As Boolean = False If array.indexof(dcs, e.DataCol.name) >= 0 Then For Each dc As String In dcs If e.DataRow.isnull(dc) Then hasnull = True Exit For End If Next If hasnull = False Then e.datarow("报备人") = _username e.datarow("报备日期") = dt End If End If |