以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 直接引用 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=191290) |
-- 作者:g1j2h3 -- 发布时间:2024/4/9 11:38:00 -- 直接引用 销售接单表想直接引用发货表的部分列,麻烦老师看下我写的代码错在那里 Dim Cols1() As String = {"车型", "车辆来源", "凭证号", "发货日期"} Dim Cols2() As String = {"车型", "车辆来源", "凭证号", "发货日期"} Dim dr As DataRow dr = DataTables("发货表").Find("[接单单号] = \'" & e.NewValue & "\'") Dim Filter As String = "[接单单号] = \'" & e.DataRow("接单单号") & "\'" Dim drs As List(Of DataRow) = DataTables("销售接单").Select(Filter) For Each dr As DataRow In drs For i As Integer = 0 To Cols1.Length - 1 dr(Cols2(i)) = drs(Cols1(i)) Next Next |
-- 作者:有点蓝 -- 发布时间:2024/4/9 12:00:00 -- datacolchanged事件?参考:http://www.foxtable.com/webhelp/topics/1451.htm If e.DataCol.Name = "接单单号" Then \'如果内容发生变动的是品名列 Dim Cols1() As String = {"车型", "车辆来源", "凭证号", "发货日期"} If e.NewValue Is Nothing Then \'如果新值是空白,也就是品名列的内容为空 For i As Integer = 0 To Cols1.Length - 1 e.DataRow(Cols1(i)) = Nothing Next ElseDim dr As DataRow \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr dr = DataTables("产品").Find("[接单单号] = \'" & e.NewValue & "\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing For i As Integer = 0 To Cols1.Length - 1 e.DataRow(Cols1(i)) = dr(Cols1(i)) Next End IfEnd If End If |
-- 作者:g1j2h3 -- 发布时间:2024/4/9 14:22:00 -- 我先有销售接单表,也就是说我想在发货表填了四项内容后,能即时填到销售接单表中 |
-- 作者:有点蓝 -- 发布时间:2024/4/9 14:26:00 -- 发货表datacolchanged事件 Select Case e.DataCol.Name Case "车型", "车辆来源", "凭证号", "发货日期" Dim Filter As String = "[接单单号] = \'" & e.DataRow("接单单号") & "\'" For i As Integer = 0 To Cols1.Length - 1 DataTables("销售接单表").ReplaceFor(Cols1(i), e.DataRow(Cols1(i)), Filter) next
End Select |
-- 作者:g1j2h3 -- 发布时间:2024/4/9 14:31:00 -- 错误提示,未声明cols1 |
-- 作者:有点蓝 -- 发布时间:2024/4/9 14:36:00 -- Select Case e.DataCol.Name Case "车型", "车辆来源", "凭证号", "发货日期" Dim Filter As String = "[接单单号] = \'" & e.DataRow("接单单号") & "\'" DataTables("销售接单表").ReplaceFor(e.DataCol.Name, e.newvalue, Filter) End Select
[此贴子已经被作者于2024/4/9 14:36:31编辑过]
|