以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  二个表之间的数据关联问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91623)

--  作者:有点蓝
--  发布时间:2016/10/15 8:57:00
--  
代码放到《监理招标信息表》DataColChanged事件

Select Case e.DataCol.name
    Case "审核"
        Dim dr As DataRow = DataTables("监理投标资料汇总").Find("项目名称 = \'" & e.DataRow("项目名称") & "\'")
        If e.NewValue <> "通过" Then
            dr.Delete
            Return
        ElseIf dr Is Nothing
            dr = DataTables("监理投标资料汇总").AddNew()
            dr("项目名称") = e.DataRow("项目名称")
        End If
        dr("归属部门") = e.DataRow("归属部门")
        dr("评标方式") = e.DataRow("评标方式")
        dr("开标日期") = e.DataRow("开标日期")
    Case "归属部门","评标方式","开标日期","项目名称"
        If e.DataRow("审核") = "通过" Then
            Dim name As String = iif(e.DataCol.name = "项目名称", e.OldValue ,e.DataRow("项目名称"))
            Dim dr As DataRow  = DataTables("监理投标资料汇总").Find("项目名称 = \'" & name & "\'")
            If dr IsNot Nothing Then
                dr(e.DataCol.Name) = e.NewValue
            End If
        End If
End Select