以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  表事件命令问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=72914)

--  作者:bestorange
--  发布时间:2015/8/8 16:21:00
--  表事件命令问题

  If e.DataCol.Name = "授课内容" Then
        If e.NewValue Is Nothing Then
            e.DataRow("培训科目") = Nothing
        Else
            Dim dr1  As  DataRow
            dr1 =  DataTables("课类分类表").Find("科目 = \'" & e.DataRow("授课内容") & "\'")
            If dr1 IsNot Nothing Then
                e.DataRow("培训科目") = dr1("培训科目")
                e.DataRow("签到时间") = Date.Today
                e.DataRow("签到次数") = 1
            End If
        End If
    End If

在这个命令之上再加一个条件,如果“分类”列下行内容为“主课”

在这里加条件还是在绑定窗口的事件命令里加??


--  作者:bestorange
--  发布时间:2015/8/8 16:24:00
--  

If e.DataRow("签到次数") = 主课 Then   ?

 


--  作者:有点蓝
--  发布时间:2015/8/8 16:29:00
--  
如果你是初始化相关的就写在绑定之前的事件中,如果你是统计或者是根据条件筛选的话就加在条件里
--  作者:大红袍
--  发布时间:2015/8/9 11:22:00
--  
If e.DataCol.Name = "授课内容" OrElse e.DataCol.Name = "分类" Then
        If e.NewValue Is Nothing Then
            e.DataRow("培训科目") = Nothing
        Else
            Dim dr1  As  DataRow
            dr1 =  DataTables("课类分类表").Find("科目 = \'" & e.DataRow("授课内容") & "\' and 分类 = \'" & e.datarow("分类") & "\'")
            If dr1 IsNot Nothing Then
                e.DataRow("培训科目") = dr1("培训科目")
                e.DataRow("签到时间") = Date.Today
                e.DataRow("签到次数") = 1
            End If
        End If
    End If