以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]引用  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=146011)

--  作者:江南小镇
--  发布时间:2020/2/14 9:32:00
--  [求助]引用
老师好,下面代码是把入库明细表的客户名称和客户ID引用到期初表中。我每次在入库明细表重置客户ID列和客户名称列后会重复引用这两列。

Select Case e.DataCol.name
    Case "客户ID","客户名称"
        If e.DataRow.IsNull("客户名称") = False AndAlso e.DataRow.IsNull("客户名称") = False Then
            
            Dim dr2 As DataRow = DataTables("期初").Find("客户名称 = \'" & e.DataRow("客户名称")  & "\'")
            If dr2 Is Nothing Then
                dr2 = DataTables("期初").AddNew
                dr2("客户名称") = e.DataRow("客户名称")
                dr2("客户ID") = e.DataRow("客户ID")
            End If
            dr2("客户ID") = e.DataRow("客户ID")
            dr2("客户名称") = e.DataRow("客户名称")            
        End If
End Select


--  作者:有点蓝
--  发布时间:2020/2/14 9:39:00
--  
Select Case e.DataCol.name
    Case "客户ID","客户名称"
        If e.DataRow.IsNull("客户ID") = False AndAlso e.DataRow.IsNull("客户名称") = False Then
            
            Dim dr2 As DataRow = DataTables("期初").Find("客户名称 = \'" & e.DataRow("客户名称")  & "\'")
            If dr2 Is Nothing Then
                dr2 = DataTables("期初").AddNew
            End If
            dr2("客户ID") = e.DataRow("客户ID")
            dr2("客户名称") = e.DataRow("客户名称")            
        End If
End Select

--  作者:江南小镇
--  发布时间:2020/2/14 10:41:00
--  
谢谢老师
--  作者:江南小镇
--  发布时间:2020/2/20 16:18:00
--  
老师,我想在下面的代码中增加规格列的引用,(同一个商品有两中以上的规格)希望把同商品不同规格的字段引用到库存表,谢谢老师。


Select Case e.DataCol.name
    Case "商品ID","商品名称","规格"
        If e.DataRow.IsNull("商品名称") = False AndAlso e.DataRow.IsNull("商品名称") = False Then
            Dim dr2 As DataRow = DataTables("库存").Find("商品名称 = \'" & e.DataRow("商品名称")  & "\'")
            If dr2 Is Nothing Then


--  作者:有点蓝
--  发布时间:2020/2/20 16:20:00
--  
        If e.DataRow.IsNull("商品名称") = False AndAlso e.DataRow.IsNull("商品名称") = False AndAlso e.DataRow.IsNull("规格") = False Then
            Dim dr2 As DataRow = DataTables("库存").Find("商品名称 = \'" & e.DataRow("商品名称")  & "\' and 规格= \'" & e.DataRow("规格")  & "\'")