以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助] 跨表更新:删除记录不起作用 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=164290) |
-- 作者:sanny -- 发布时间:2021/5/4 22:13:00 -- [求助] 跨表更新:删除记录不起作用 老师,以下两个代码用在表属性中。当表SDBC_Sq删除记录后,为什么表Incoming中的QCQty 没有更新 ? If e.DataCol.Name = "BatchNo" Then Dim sum As Double= 0 For Each dr1 As DataRow In DataTables("SDBC_Sq").Select("BatchNo=\'" & e.NewValue & "\'") sum += dr1("IncomingQty") Next e.DataRow("QCQty") = sum End If If e.DataCol.Name = "BatchNo" OrElse e.DataCol.Name = "IncomingQty" Then Dim pr As DataRow pr = DataTables("Incoming").Find("BatchNo = \'" & e.DataRow("BatchNo") & "\'") If pr IsNot Nothing Then DataTables("Incoming").DataCols("BatchNo").RaiseDataColChanged(pr) End If End If |
-- 作者:有点蓝 -- 发布时间:2021/5/5 9:02:00 -- 代码在什么事件? 删除记录应该到DataRowDeleting事件处理:http://www.foxtable.com/webhelp/topics/0633.htm e.DataRow("IncomingQty") = 0 Dim pr As DataRow pr = DataTables("Incoming").Find("BatchNo = \'" & e.DataRow("BatchNo") & "\'") If pr IsNot Nothing Then DataTables("Incoming").DataCols("BatchNo").RaiseDataColChanged(pr) End If |