以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求助多列改变事件的代码错在何处?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=144463)

--  作者:有点蓝
--  发布时间:2019/12/20 22:18:00
--  
Select Case e.DataCol.Name
    Case "学校名称"
        Dim dr As DataRow = DataTables("片区校名一览表").Find("学校简称2字符 = \'" & e.DataRow("学校名称") & "\'")
        If dr IsNot Nothing  Then
            e.DataRow("学校编码") = dr("学校编码")
        Else
            e.DataRow("学校编码") = Nothing
        End If
    Case "年级简称"
        Dim dr1 As DataRow = DataTables("片区年级一览表").Find("年级简称 = \'" & e.DataRow("年级简称") & "\'")
        If dr1 IsNot Nothing Then
            e.DataRow("年级编码") = dr1("年级编码")
        Else
            e.DataRow("年级编码") = Nothing
        End If
    Case "班级序号","学校编码","年级编码"
        If e.DataRow.IsNull("学校编码") OrElse e.DataRow.IsNull("年级编码") OrElse e.DataRow.IsNull("班级序号") Then
            e.DataRow("班级编号") = Nothing
        Else
            e.DataRow("班级编号") = e.DataRow("学校编码")  & e.DataRow("年级编码") & e.DataRow("班级序号")
        End If
End Select

--  作者:有点蓝
--  发布时间:2019/12/21 8:26:00
--  
直接清除即可

    Case "学校名称"
        Dim dr As DataRow = DataTables("片区校名一览表").Find("学校简称2字符 = \'" & e.DataRow("学校名称") & "\'")
        If dr IsNot Nothing  Then
            e.DataRow("学校编码") = dr("学校编码")
        Else
            e.DataRow("学校编码") = Nothing
        End If
        e.DataRow("年级简称") = Nothing
        e.DataRow("年级编码") = Nothing
    Case "年级简称"

[此贴子已经被作者于2019/12/21 8:26:53编辑过]