以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  代码执行不了  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=128292)

--  作者:ZJZK2018
--  发布时间:2018/12/3 12:15:00
--  代码执行不了
在表DataColChanged事件中下面代码执行不了

Dim dr As DataRow = e.DataRow

Select Case e.DataCol.Name

    Case "审核"

        If e.NewValue = True Then

            If e.DataCol.Name.Contains("审核人") Then

                dr("审核人") = User.Name

            ElseIf e.DataCol.Name.Contains("审核日期") Then

                dr("审核日期") = Date.Today

            End If

        Else

            If e.DataCol.Name.Contains("审核人") Then

                dr("审核人") = Nothing

            ElseIf e.DataCol.Name.Contains("审核日期") Then

                dr("审核日期") = Nothing

            End If

        End If

End Select


需求是最后在全局代码中写入,如果表中有“审核”列时,“审核人”、“审核日期”(这二个不一定有或全有)如果有就执行,没有就return


--  作者:有点甜
--  发布时间:2018/12/3 12:51:00
--  

Dim dr As DataRow = e.DataRow

Select Case e.DataCol.Name
   
    Case "审核"
       
        If e.NewValue = True Then
           
            If e.DataCol.Name.Contains("审核人") Then
               
                dr("审核人") = User.Name
            End If
            If e.DataCol.Name.Contains("审核日期") Then
               
                dr("审核日期") = Date.Today
               
            End If
           
        Else
           
            If e.DataCol.Name.Contains("审核人") Then
               
                dr("审核人") = Nothing
            End If
            If e.DataCol.Name.Contains("审核日期") Then               
                dr("审核日期") = Nothing               
            End If
           
        End If
       
End Select

 


--  作者:ZJZK2018
--  发布时间:2018/12/3 13:26:00
--  
还是不行??

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目3.table



--  作者:有点甜
--  发布时间:2018/12/3 13:48:00
--  
Dim dr As DataRow = e.DataRow
Select Case e.DataCol.name
    Case "审核"
        If e.NewValue = True Then
           
            If e.DataTable.DataCols.Contains("审核人") Then
                dr("审核人") = User.Name
            End If
            If e.DataTable.DataCols.Contains("审核日期") Then
                dr("审核日期") = Date.Today
            End If
        Else
            If e.DataTable.DataCols.Contains("审核人") Then
                dr("审核人") = Nothing
            End If
            If e.DataTable.DataCols.Contains("审核日期") Then
                dr("审核日期") = Nothing
            End If
        End If
End Select