以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]还是关于日期空值的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=34922) |
-- 作者:ifastudy -- 发布时间:2013/6/19 12:07:00 -- [求助]还是关于日期空值的问题 找到了is null不能用的情况。 不在filter和表达式,就在一般代码中,如何判断一个日期是否为空呢?
commitdate = iif(TempDate Is null, dr("波段交期"),TempDate) commitdate = iif(TempDate Is Nothing, dr("波段交期"),TempDate)
以上都提示错误 |
-- 作者:Bin -- 发布时间:2013/6/19 12:09:00 -- dr.isNUll("波段交期") 楼主需要再看一遍帮助. 如果是判断一个值是否为空 commitdate is nothing
|
-- 作者:ifastudy -- 发布时间:2013/6/19 13:44:00 -- 哦。谢谢指导。等我把系统上线后,一定好好看一遍。 |
-- 作者:ifastudy -- 发布时间:2013/6/19 14:17:00 -- “如果是判断一个值是否为空 commitdate is nothing” |
-- 作者:狐狸爸爸 -- 发布时间:2013/6/19 14:17:00 -- 贴出你的完整代码吧 |
-- 作者:ifastudy -- 发布时间:2013/6/19 14:25:00 -- Dim commitdate As Date = iif(dr("使用虚拟交期"),dr("虚拟交期"),dr("承诺交期")) If commitdate Is Nothing \'此处报错 Dim dr0 As DataRow = DataTables("订单节点").find("[订单编号]=\'" & dr("订单编号") & "\' and [节点名]=\'完成投单\'") If dr0 IsNot Nothing commitdate = dr0("实际完成日期") commitdate = commitdate.AddDays(PT_LT) End If End If |
-- 作者:Bin -- 发布时间:2013/6/19 14:31:00 -- 由于Date类型比较特殊,是不可为空类型 那么要这样判断 Dim d As Date If d =DateTime.MinValue Then MessageBox.show("我是空值") End If [此贴子已经被作者于2013-6-19 14:30:50编辑过]
|
-- 作者:ifastudy -- 发布时间:2013/6/19 14:33:00 -- 明白了,谢谢。 |