以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  除法中的容错问题,  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=143258)

--  作者:ZHB790613
--  发布时间:2019/11/18 21:22:00
--  除法中的容错问题,

 

Select Case e.DataCol.name
        Case "订单数量","备货数量","生产数量"   
        If e.DataRow.Isnull("订单数量") Then
            e.DataRow("开单平方")=Nothing
        Else
            e.DataRow("生产数量")=e.DataRow("订单数量") + e.DataRow("备货数量")
            e.DataRow("开单平方")=(e.DataRow("订单数量") + e.DataRow("备货数量"))/e.DataRow("平方数")
    
    End If
   
End Select

 

e.DataRow("平方数")如果为0值,如何容错处理?

 


--  作者:ZHB790613
--  发布时间:2019/11/18 21:33:00
--  
除数如果为0,代码如何处理一下,新手求教
--  作者:有点蓝
--  发布时间:2019/11/18 22:02:00
--  
Select Case e.DataCol.name
        Case "订单数量","备货数量","生产数量"    
        If e.DataRow.Isnull("订单数量") Then
            e.DataRow("开单平方")=Nothing
        Else
            e.DataRow("生产数量")=e.DataRow("订单数量") + e.DataRow("备货数量")
if e.DataRow("平方数") = 0 then
e.DataRow("开单平方")=0
else
            e.DataRow("开单平方")=(e.DataRow("订单数量") + e.DataRow("备货数量"))/e.DataRow("平方数")
     end if
    End If
    
End Select

--  作者:ZHB790613
--  发布时间:2019/11/21 7:37:00
--  

谢谢帮助,代码OK