以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 在DataColChanged,当前行的一列发生变化时,数据自动更新;我想改为保存后再数据自动更新、 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74510) |
-- 作者:yancheng -- 发布时间:2015/9/12 23:11:00 -- 在DataColChanged,当前行的一列发生变化时,数据自动更新;我想改为保存后再数据自动更新、 问题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的区别。不知道这样理解是否是对的,及原因; |
-- 作者:大红袍 -- 发布时间:2015/9/13 10:31:00 -- BeforeSaveDataRow事件
Dim nm() As String = {"采购订单","采购进货","销售订单","销售明细","收支管理","设计汇总","工资发放","洽商汇总","考勤","预算计划","预算计划明细","需用计划","需用计划明细","机具订单","机具进货"} For Each n As String In nm
|
-- 作者:yancheng -- 发布时间:2015/9/13 13:23:00 -- DataTables(n).ReplaceFor("合同名称",e.DataRow("合同名称"),"合同编号 = \'" & e.DataRow.OriginalValue("合同名称") & "\'") 请问,这行代码。是不是应该是: DataTables(n).ReplaceFor("合同名称",e.DataRow("合同名称"),"合同名称 = \'" & e.DataRow.OriginalValue("合同名称") & "\'") 或者: DataTables(n).ReplaceFor("合同名称",e.DataRow("合同名称"),"合同编号 = \'" & e.DataRow.OriginalValue("合同编号") & "\'")
[此贴子已经被作者于2015/9/13 13:41:59编辑过]
|
-- 作者:大红袍 -- 发布时间:2015/9/13 14:46:00 -- Dim nm() As String = {"采购订单","采购进货","销售订单","销售明细","收支管理","设计汇总","工资发放","洽商汇总","考勤","预算计划","预算计划明细","需用计划","需用计划明细","机具订单","机具进货"} For Each n As String In nm DataTables(n).ReplaceFor("合同编号",e.DataRow("合同编号"),"合同编号 = \'" & e.DataRow.OriginalValue("合同编号") & "\'") |