以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  跨表引用  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153751)

--  作者:13796361423
--  发布时间:2020/8/21 15:09:00
--  跨表引用

我练习跨表引用, 想把产品表的四列追过来, 一点反应也没有

If e.DataCol.Name = "产品编号" Then
     Dim nms() As String = {"品名","型号","规格","单价"}
     If e.NewValue Is Nothing Then
         For Each nm As String In nms
             e.DataRow(nm) = Nothing
         Next
     Else
         Dim dr As DataRow
         dr = DataTables("产品").Find("[产品编号] = \'" & e.NewValue & " \'")
        If dr IsNot Nothing
             For Each nm As String In nms
                 e.DataRow(nm) = dr(nm)
             Next
         End If
     End If
 End If

 

帮我看看, 把这个命令放在订单表的datecolchanged事件里了, 咋不好使呢


--  作者:有点蓝
--  发布时间:2020/8/21 15:47:00
--  
dr = DataTables("产品").Find("[产品编号] = \'" & e.NewValue & "\'")  第二个单引号前面多了一个空格
--  作者:13796361423
--  发布时间:2020/8/21 16:21:00
--  
If e.DataCol.Name = "产品编号" Then
     Dim nms() As String = {"品名","型号","规格","单价"}
     If e.NewValue Is Nothing Then
         For Each nm As String In nms
             e.DataRow(nm) = Nothing
         Next
     Else
         Dim dr As DataRow
         dr = DataTables("产品").Find("[产品编号] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
             For Each nm As String In nms
                 e.DataRow(nm) = dr(nm)
             Next
         End If
     End If
 End If