Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:直接引用

1楼
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
2楼
有点蓝 发表于: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
    Else
        Dim
 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 If
    End
 If
End
 If



3楼
g1j2h3 发表于:2024/4/9 14:22:00
我先有销售接单表,也就是说我想在发货表填了四项内容后,能即时填到销售接单表中
4楼
有点蓝 发表于: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
5楼
g1j2h3 发表于:2024/4/9 14:31:00
错误提示,未声明cols1
6楼
有点蓝 发表于:2024/4/9 14:36:00
Select Case e.DataCol.Name
    Case
 
"车型", "车辆来源", "凭证号", "发货日期"
        
Dim Filter As String = "[接单单号] = '" & e.DataRow("接单单号") & "'"
        DataTables("销售接单表").ReplaceFor(e.DataCol.Namee.newvalueFilter)
End Select
[此贴子已经被作者于2024/4/9 14:36:31编辑过]
共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02441 s, 2 queries.