以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  为什么会发生调用的目标发生异常  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91530)

--  作者:zhuxin
--  发布时间:2016/10/12 17:27:00
--  为什么会发生调用的目标发生异常

If e.DataCol.Name = e.DataCol.Name = "编码" Then
    Dim dr As DataRow
    Dim Filter As String
    Filter = "[供应商] = \'" & e.DataRow("供应商") & "\' And [编码] = \'" & e.DataRow("编码") & "\'"
    dr = DataTables("供应商单价表").Find(Filter)
    If dr IsNot Nothing Then
        e.DataRow("核对单价") = dr("单价")
    Else
        e.DataRow("核对单价") = Nothing
    End If
    Dim d1 As DataRow
    Dim F1 As String
    F1 = "[编码] = \'" & e.DataRow("编码") & "\'"
    d1 = DataTables("货品资料").Find(F1)
    If d1 IsNot Nothing Then
        e.DataRow("类别") = d1("货品类别")
    Else
        e.DataRow("类别") = Nothing
    End If
End If

 

 

调用的目标发生了异常。


--  作者:有点蓝
--  发布时间:2016/10/12 17:35:00
--  
If e.DataCol.Name = "编码" Then
    Dim dr As DataRow
    Dim Filter As String
    Filter = "[供应商] = \'" & e.DataRow("供应商") & "\' And [编码] = \'" & e.DataRow("编码") & "\'"
    dr = DataTables("供应商单价表").Find(Filter)
    If dr IsNot Nothing Then
        e.DataRow("核对单价") = dr("单价")
    Else
        e.DataRow("核对单价") = Nothing
    End If
    Dim d1 As DataRow
    Dim F1 As String
    F1 = "[编码] = \'" & e.DataRow("编码") & "\'"
    d1 = DataTables("货品资料").Find(F1)
    If d1 IsNot Nothing Then
        e.DataRow("类别") = d1("货品类别")
    Else
        e.DataRow("类别") = Nothing
    End If
End If
--  作者:zhuxin
--  发布时间:2016/10/12 17:38:00
--  

测试通过了,原来是自已写错了