我有两表,分别是表A和表B,表A从另一个系统的视图取数,代码如下se/ect * from {FF部门档案} ORDER BY cDepCode ASC
然后将相关字段信息复制到表B,表A的DataColChanged事件如下
Select Case e.DataCol.name
Case "cdepcode"
Dim dr As DataRow = DataTables("表B").Find("FF部门编号 = '" & e.OldValue & "'")
If dr Is Nothing And e.DataRow("bdepend") = True Then
dr = DataTables("表B").AddNew()
dr("FF部门编号") = e.DataRow("cdepcode")
dr("FF部门名称") = e.DataRow("cdepname")
If e.DataRow.IsNull("dDepEndDate") = False Then
dr("撤销标记") = "已撤销"
End If
ElseIf dr IsNot Nothing And e.DataRow("bdepend") = True Then
dr("FF部门编号") = e.DataRow("cdepcode")
If e.DataRow.IsNull("dDepEndDate") = False Then
dr("撤销标记") = "已撤销"
End If
End If
Case "cdepname"
Dim dr As DataRow = DataTables("表B").Find("FF部门编号 = '" & e.DataRow("cdepcode") & "'")
If dr IsNot Nothing Then
dr("FF部门名称") = e.DataRow("cdepname")
End If
End Select
然后表B的的DataColChanged事件如下
Select Case e.DataCol.name
Case "FF部门编号"
Dim dr As DataRow = e.DataRow
Dim dr1 As DataRow = DataTables("表A").Find("cdepcode = '" & dr("FF部门编号") & "'")
If dr1 Is Nothing Then
dr.Delete()
End If
End Select
当表A少了条记录后,表B虽然也同时删除了这条记录,但会出现下面的提示,如何去掉这个提示呢
此主题相关图片如下:b3a9e3167ab0828cc69a7ce1c00c26d8.png