问题1:
施工合同,表,DataColChanged,写入如下代码: (当前行的一列发生变化时,数据自动更新;)但是,我想改为保存后再数据自动更新;请问老师,应该怎么写,写在哪里?
Select Case e.DataCol.Name
Case "合同编号"
If e.NewValue IsNot Nothing Then
Dim nm() As String = {"采购订单","采购进货","销售订单","销售明细"}
Dim nms() As String = {"收支管理","设计汇总","工资发放","洽商汇总","考勤","预算计划","预算计划明细","需用计划","需用计划明细","机具订单","机具进货"}
For Each n As String In nm
DataTables(n).ReplaceFor("合同名称",e.DataRow("合同名称"),"合同编号 = '" & e.NewValue & "'")
Next
For Each n1 As String In nms
DataTables(n1).ReplaceFor(e.DataCol.Name,e.NewValue,"合同编号 = '" & e.OldValue & "'")
Next
Else
MessageBox.Show("""合同编号""为空,请输入新的值.",MessageBoxButtons.OK,MessageBoxIcon.Warning)
e.Cancel = True
End If
End Select
问题2:
Dim nm() As String = {"采购订单","采购进货","销售订单","销售明细"}
Dim nms() As String = {"收支管理","设计汇总","工资发放","洽商汇总","考勤","预算计划","预算计划明细","需用计划","需用计划明细","机具订单","机具进货"}
For Each n As String In nm
DataTables(n).ReplaceFor("合同名称",e.DataRow("合同名称"),"合同编号 = '" & e.NewValue & "'")
Next
For Each n1 As String In nms
DataTables(n1).ReplaceFor(e.DataCol.Name,e.NewValue,"合同编号 = '" & e.OldValue & "'")
Next
我写了两个循环来更改:关联与非关联表的值。 因为,我感觉,它们是不同的,如果用一条同样的代码,好像会出错。就是:e.oldvalue,与e.newvalue的区别。不知道这样理解是否是对的,及原因;