以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  空值问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=183927)

--  作者:实话实说
--  发布时间:2022/11/19 12:09:00
--  空值问题
下面代码执行出现错误,不知错在哪?

图片点击可在新窗口打开查看此主题相关图片如下:snap1.jpg
图片点击可在新窗口打开查看

\'订单数量从销售订单明细中取数
销售订单明细的”颜色“列允许有空值
If e.DataCol.Name ="订单单号" Or e.DataCol.Name ="产品代码" Or e.DataCol.Name ="颜色"  Then 
    If DataTables("销售订单明细").datarows("颜色") Is Nothing Then
        Dim dt As DataRow = DataTables("销售订单明细").Find(" 订单单号 = " & "\'" & e.DataRow("订单单号") & "\'and 产品代码 = " & "\'" & e.DataRow("产品代码") & "\'and  颜色 = " & "\'" & e.DataRow("颜色") & "\'" )
        If dt IsNot Nothing \'如果找到,则设置各列内容
            e.DataRow("订单数量")= dt("订单数量")
        End If
    Else
        Dim df As DataRow = DataTables("销售订单明细").Find(" 订单单号 = " & "\'" & e.DataRow("订单单号") & "\'and 产品代码 = " & "\'" & e.DataRow("产品代码") & "\'" )
        If df IsNot Nothing \'如果找到,则设置各列内容
            e.DataRow("订单数量")= df("订单数量")
        End If
    End If
End If



--  作者:有点蓝
--  发布时间:2022/11/19 13:56:00
--  
If DataTables("销售订单明细").datarows("颜色") Is Nothing Then
改为
If e.datarows.isnull("颜色") =false Then

--  作者:实话实说
--  发布时间:2022/11/19 14:12:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:snap2.jpg
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2022/11/19 14:22:00
--  
多了个s,自己去掉,发帖几千了这种基本的错误自己都看不出?
--  作者:实话实说
--  发布时间:2022/11/19 14:26:00
--  
知道了,谢谢。