Foxtable(狐表)用户栏目专家坐堂 → [求助]NULL


  共有1769人关注过本帖树形打印复制链接

主题:[求助]NULL

帅哥哟,离线,有人找我吗?
huhu
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
[求助]NULL  发帖心情 Post By:2016/5/12 9:14:00 [只看该作者]

后台数据的某列A值为NULL,
我在代码里面想判断一下怎么写。
1.if dr5.isnull("A") then
2.if dr5("A") = “NULL” then
3.if dr5(A) is nothing then


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/12 9:16:00 [只看该作者]

这种问题,你测试一下不就知道了?

 

 if dr5.isnull("A") then

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
huhu
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
  发帖心情 Post By:2016/5/12 9:28:00 [只看该作者]

我之前代码就是这么写的。用isnull。但发现去执行了蓝色的代码。注:scriptval8后台的值就是NULL
Dim dr5 As DataRow = DataTables("assemblyScriptParamter").SQLFind("workOrderNo = '" & dr3("WorkOrderNo") & "' and lineFlag = '" & dr2("LineFlag") & "'")
                                If dr5 IsNot Nothing Then
                                    If dr5.IsNull("scriptval8") Then
                                        Dim kwlb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox1")
                                        Dim rklb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox2")
                                        e.DataRow("库位类别") = kwlb.text
                                        e.DataRow("入库类别") = rklb.text
                                        e.DataRow("数量") = 1
                                        e.DataRow("状态") = "生产结束扫描完成"
                                        e.DataRow("入库方式") = "扫描入库"
                                        e.DataRow("生产结束扫描完成时间") = Date.now
                                        e.DataRow.locked = True
                                        e.DataRow.Save
                                        Dim ssdsl As WinForm.Button = Forms("生产入库").Controls("Button3")
                                        Dim sum As Integer = DataTables("扫描配货明细").SQLCompute("Sum(数量)","状态 = '生产结束扫描完成'")
                                        ssdsl.text = "实扫到数量:" & sum
                                    Else
                                        If dr1("status") = "-1" Then
                                            Dim kwlb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox1")
                                            Dim rklb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox2")
                                            e.DataRow("库位类别") = kwlb.text
                                            e.DataRow("入库类别") = rklb.text
                                            e.DataRow("数量") = 1
                                            e.DataRow("状态") = "生产结束扫描完成"
                                            e.DataRow("入库方式") = "扫描入库"
                                            e.DataRow("生产结束扫描完成时间") = Date.now
                                            e.DataRow.locked = True
                                            e.DataRow.Save
                                            Dim ssdsl As WinForm.Button = Forms("生产入库").Controls("Button3")
                                            Dim sum As Integer = DataTables("扫描配货明细").SQLCompute("Sum(数量)","状态 = '生产结束扫描完成'")
                                            ssdsl.text = "实扫到数量:" & sum
                                        Else
                                            e.DataRow("数量") = 0
                                            e.DataRow("状态") = "不符合入库条件"
                                            e.DataRow.locked = True
                                            Dim drr12 As DataRow = DataTables("生产扫描异常").Find("SN = '" &  e.DataRow("SN") & "'  and 生产订单号码工单行号 = '" & e.DataRow("生产订单号码工单行号") & "'")
                                            If drr12 Is Nothing Then
                                                Dim drrr12 As DataRow = DataTables("生产扫描异常").AddNew
                                                For Each nm As String In nms
                                                    drrr12(nm) = e.DataRow(nm)
                                                Next
                                                drrr12("生产订单号码工单行号") = gdhhh.text
                                                drrr12("数量") = 0
                                                drrr12("SN") = e.DataRow("SN")
                                                drrr12.Locked = True
                                            End If
                                        End If
                                    End If

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/12 9:41:00 [只看该作者]

msgbox(dr5("scriptval8"))

msgbox(dr5.IsNull("scriptval8"))

msgbox(dr5("scriptval8") = nothing)

 


 回到顶部