以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]跨表修改 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=33824) |
-- 作者:lsf5138 -- 发布时间:2013/5/25 9:02:00 -- [求助]跨表修改 请问这样的代码有问题吗?为什么我修改了 "规格" 后, "生产排单" "改码记录" 二个表的 "规格" 都不反应了! Select Case e.DataCol.Name Case "规格" Dim dr As DataRow = e.DataRow If dr.IsNull("规格") Then dr("规格转换") = Nothing Else dr("规格转换") = eval(dr("规格")) / 10000 End If Case "针数","专数","针种" Dim dr As DataRow = e.DataRow If dr.IsNull("针数") Or dr.IsNull("专数") Or dr.IsNull("针种") Then dr("挡车基数") = Nothing Else dr("挡车基数") = dr("针数") / dr("针种") * dr("专数") End If Case "挡车基数" Dim Filter As String = "[产品ID] = \'" & e.DataRow("产品ID") & "\'" DataTables("生产明细").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("改码记录").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("生产明细").Save() DataTables("改码记录").Save() Case "订单ID","客户","款号","颜色","缸号","品名","尺码","规格" Dim Filter As String = "[产品ID] = \'" & e.DataRow("产品ID") & "\'" DataTables("生产排单").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("改码记录").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("生产排单").Save() DataTables("改码记录").Save() Case "产品单价" Dim Filter As String = "[产品ID] = \'" & e.DataRow("产品ID") & "\'" DataTables("出货明细").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("出货明细").Save() End Select |
-- 作者:lsy -- 发布时间:2013/5/25 9:12:00 -- 一串代码,不如一个实例来的直接。 实例可以验证。 |
-- 作者:don -- 发布时间:2013/5/25 9:17:00 -- Select Case每个Case不能重叠的,否则后面的不执行! Dim dr As DataRow = e.DataRow Dim Filter As String = "[产品ID] = \'" & dr("产品ID") & "\'" Select Case e.DataCol.Name Case "规格" If dr.IsNull("规格") Then dr("规格转换") = Nothing Else dr("规格转换") = eval(dr("规格")) / 10000 End If End Select Select Case e.DataCol.Name Case "针数","专数","针种" If dr.IsNull("针数") Or dr.IsNull("专数") Or dr.IsNull("针种") Then dr("挡车基数") = Nothing Else dr("挡车基数") = dr("针数") / dr("针种") * dr("专数") End If Case "挡车基数" DataTables("生产明细").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("改码记录").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("生产明细").Save() DataTables("改码记录").Save() Case "订单ID","客户","款号","颜色","缸号","品名","尺码","规格" DataTables("生产排单").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("改码记录").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("生产排单").Save() DataTables("改码记录").Save() Case "产品单价" DataTables("出货明细").ReplaceFor(e.DataCol.Name, e.NewValue, Filter) DataTables("出货明细").Save() End Select |
-- 作者:lsf5138 -- 发布时间:2013/5/25 9:46:00 -- 怪不得原来只有一组Case的时候都没问题 感谢!!! |