关于通过子表出发父表表达式列的DataColChanged 事件,由于父表好几列都是表达式列,而且数据都是是通过子表统计而得的,我在子表DataColChanged 中写下面代码,是可以触发父表事件的,但写成下面红色部分的代码时会出错,请帮我看下是错在哪!
If e.DataCol.name = "XiaoShouDanMingXi_ShuLiang" Then
Dim pr As DataRow = e.DataRow.GetParentRow("XiaoShouDan") '找出对应的父行
If pr IsNot Nothing Then
DataTables("XiaoShouDan").DataCols("XiaoShouDan_ShuLiang").RaiseDataColChanged(pr) '通知系统此父行的数量列发生了改变,触发DataColChanged事件
End If
End If
If e.DataCol.name = "XiaoShouDanMingXi_PiFaJia" Then
Dim pr As DataRow = e.DataRow.GetParentRow("XiaoShouDan") '找出对应的父行
If pr IsNot Nothing Then
DataTables("XiaoShouDan").DataCols("XiaoShouDan_PiFaE").RaiseDataColChanged(pr) '通知系统此父行的数量列发生了改变,触发DataColChanged事件
End If
End If
If e.DataCol.name = "XiaoShouDanMingXi_YouHuiJia" Then
Dim pr As DataRow = e.DataRow.GetParentRow("XiaoShouDan") '找出对应的父行
If pr IsNot Nothing Then
DataTables("XiaoShouDan").DataCols("XiaoShouDan_YouHuiE").RaiseDataColChanged(pr) '通知系统此父行的数量列发生了改变,触发DataColChanged事件
End If
End If
If e.DataCol.name = "XiaoShouDanMingXi_ChengBenJia" Then
Dim pr As DataRow = e.DataRow.GetParentRow("XiaoShouDan") '找出对应的父行
If pr IsNot Nothing Then
DataTables("XiaoShouDan").DataCols("XiaoShouDan_ChengBenE").RaiseDataColChanged(pr) '通知系统此父行的数量列发生了改变,触发DataColChanged事件
End If
End If
If e.DataCol.name = "XiaoShouDanMingXi_LingShouJia" Then
Dim pr As DataRow = e.DataRow.GetParentRow("XiaoShouDan") '找出对应的父行
If pr IsNot Nothing Then
DataTables("XiaoShouDan").DataCols("XiaoShouDan_LingShouE").RaiseDataColChanged(pr) '通知系统此父行的数量列发生了改变,触发DataColChanged事件
End If
End If
能写成下面怎样吗,我写成下面这样的形式会执行错误,帮我看下哪有问题,或者有什么简洁一点的写法
Select Case e.DataCol.name
Case "XiaoShouDanMingXi_ShuLiang" ,"XiaoShouDanMingXi_PiFaJia","XiaoShouDanMingXi_YouHuiJia","XiaoShouDanMingXi_ChengBenJia","XiaoShouDanMingXi_LingShouJia"
Dim pr As DataRow = e.DataRow.GetParentRow("XiaoShouDan") '找出对应的父行
If pr IsNot Nothing Then
DataTables("XiaoShouDan").DataCols("XiaoShouDan_ShuLiang").RaiseDataColChanged(pr) '通知系统此父行的数量列发生了改变,触发DataColChanged事件
DataTables("XiaoShouDan").DataCols("XiaoShouDan_ChengBenE").RaiseDataColChanged(pr)
DataTables("XiaoShouDan").DataCols("XiaoShouDan_PiFaE").RaiseDataColChanged(pr)
DataTables("XiaoShouDan").DataCols("XiaoShouDan_YouHuiE").RaiseDataColChanged(pr)
DataTables("XiaoShouDan").DataCols("XiaoShouDan_LingShouE").RaiseDataColChanged(pr)
DataTables("XiaoShouDan").DataCols("XiaoShouDan_MaoLi").RaiseDataColChanged(pr)
DataTables("XiaoShouDan").DataCols("XiaoShouDan_YingShouKuanE").RaiseDataColChanged(pr)
End If
End Select