
此主题相关图片如下:qq截图20110927181623.png

如题,感谢!
Select Case e.DataCol.name
Case "已审批金额"
Dim pr As DataRow = e.DataRow.GetParentRow("合同信息汇总表")
Dim dr As DataRow = e.DataRow.GetParentRow("营销类合同")
If pr("已审批金额") > pr("合同金额") OrElse dr("已审批金额") > dr("合同金额")
e.DataRow("已审批金额") = e.OldValue
messagebox.show("请注意,累计审批金额已超过合同金额!")
End If
End Select
If e.DataCol.Name = "结账" Then
If e.NewValue = True Then
e.DataRow.Locked = True
End If
End If
麻烦帮我看下这段代码可能在哪里出了问题?谢谢了,另外请问为什么我的帖子不能按我拍好的版显示??
以下是引用程兴刚在2011-9-27 19:14:00的发言:
贴出您的代码!
Select Case e.DataCol.name Case "已审批金额" Dim pr As DataRow = e.DataRow.GetParentRow("合同信息汇总表") Dim dr As DataRow = e.DataRow.GetParentRow("营销类合同") If pr("已审批金额") > pr("合同金额") OrElse dr("已审批金额") > dr("合同金额") e.DataRow("已审批金额") = e.OldValue messagebox.show("请注意,累计审批金额已超过合同金额!") End If End Select If e.DataCol.Name = "结账" Then If e.NewValue = True Then e.DataRow.Locked = True End If End If
你要确定pr和dr是否存在?
[此贴子已经被作者于2011-9-27 19:35:10编辑过]
怀疑他是直接在子表操作,而不是通过关联表增加子表的行,这样的话,有可能关联的父表记录根本不存在,导致出错!
我在避免这方面出错的方法,禁止直接选择子表为主表,也就是判断当前主表为子表时,禁止编辑、修改等操作
我是这样做的,请帮我看看是什么问题,谢谢!
[此贴子已经被作者于2011-9-27 20:18:24编辑过]