以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 自动默认为0的函数如何写? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=77146) |
-- 作者:owenlyx -- 发布时间:2015/11/11 20:50:00 -- 自动默认为0的函数如何写? 代码如下: Dim dr As DataRow Dim dd As DataRow Dim dc As DataRow dr = DataTables("进货明细").Find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 基本款号 = \'" & e.Form.Controls("combobox2").text & "\'") dd= DataTables("销售表").find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 基本款号 = \'" & e.Form.Controls("combobox2").text & "\'") dc= DataTables("退货表").Find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 退货款号 = \'" & e.Form.Controls("combobox2").text & "\'") ‘If dr IsNot Nothing And dd IsNot Nothing And dc IsNot Nothing Then e.Form.Controls("label11").text = dr("件数") - dd("件数") -dc("件数") 用什么函数可以设置 ’销售表‘里找不到此行自动默认为0 ,同理‘退货表’ 也是一样,请问代码如何写?
|
-- 作者:qtcks -- 发布时间:2015/11/12 2:55:00 -- Dim dr As DataRow Dim dd As DataRow Dim dc As DataRow dr = DataTables("进货明细").Find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 基本款号 = \'" & e.Form.Controls("combobox2").text & "\'") dd= DataTables("销售表").find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 基本款号 = \'" & e.Form.Controls("combobox2").text & "\'") dc= DataTables("退货表").Find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 退货款号 = \'" & e.Form.Controls("combobox2").text & "\'") ‘If dr IsNot Nothing And dd IsNot Nothing And dc IsNot Nothing Then e.Form.Controls("label11").text = IIF(dr = Nothing ,0,dr("件数")) - IIF(dd = Nothing,0,dd("件数")) -IIF(dc = Nothing,0,dc("件数") )
|
-- 作者:Hyphen -- 发布时间:2015/11/12 9:00:00 -- e.Form.Controls("label11").text = IIF(dr = Nothing ,0,IIF(dr.IsNull("件数"),0,dr("件数"))) - IIF(dd = Nothing,0,IIF(dd.IsNull("件数"),0,dd("件数"))) -IIF(dc = Nothing,0,IIF(dc.IsNull("件数"),0,dc("件数")) ) |
-- 作者:owenlyx -- 发布时间:2015/11/12 11:57:00 -- 谢谢 |
-- 作者:owenlyx -- 发布时间:2015/11/12 22:23:00 -- 但是一直还是报错。 我用的代码是这个: Dim dr As DataRow Dim dd As DataRow Dim dc As DataRow dr = DataTables("进货明细").Find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 基本款号 = \'" & e.Form.Controls("combobox2").text & "\'") dd= DataTables("销售表").find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 基本款号 = \'" & e.Form.Controls("combobox2").text & "\'") dc= DataTables("退货表").Find("条码号 = \'"& e.Form.Controls("combobox1").text & "\'and 退货款号 = \'" & e.Form.Controls("combobox2").text & "\'") \'If dr IsNot Nothing And dd IsNot Nothing And dc IsNot Nothing Then e.Form.Controls("label11").text = IIF(dr Is Nothing ,0,dr("件数")) - IIF(dd Is Nothing,0,dd("件数")) -IIF(dc Is Nothing,0,dc("件数")) [此贴子已经被作者于2015/11/12 22:23:07编辑过]
|
-- 作者:大红袍 -- 发布时间:2015/11/12 22:28:00 -- Dim sum As Double = 0 e.Form.Controls("label11").text = sum |