如何显示或计算空值? [英] How to display or also count the empty value?

查看:118
本文介绍了如何显示或计算空值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用oledb已经在我的数据库中连接了datagridview。它还显示计数查询,它还计算临界级别的结果。



我有活动,备用,有缺陷的物品。



Datagridview示例:



有效1000

瑕疵10

备用50



已经计算出有缺陷的等级。但如果缺陷是零或没有。它变成这样:



有效1000

备用50



它将备用视为瑕疵。我想在Datagridview中显示缺陷是0,如果不存在的话。为了防止计算备件有缺陷。



我尝试过:



 Dim Activeqty As Integer 
Dim Spareqty As Integer
Dim defectqty As Integer

Activeqty = DataGridView1.Rows(0).Cells(1) .Value.ToString()
defectqty = DataGridView1.Rows(1).Cells(1).Value.ToString()
Spareqty = DataGridView1.Rows(2).Cells(1).Value.ToString ()





 Activepercentage = Activeqty * 0.1 
如果Actprcnt> defectqty然后
CriticalReport.Listview.Items.Add(CRITICAL)
结束如果

解决方案

< blockquote>请参考: SQL提示:COUNTing NULL值 - 本杰明的博客 [ ^ ]


I have datagridview that is already connected in my database using oledb. And it also displaying the count query and it also compute the results that are in critical level.

I have Active, Spare, Defective items.

Sample in Datagridview:

Active 1000
Defective 10
Spare 50

It is already compute the level of the defective. But if the defective is zero or none. It becoming like this:

Active 1000
Spare 50

It counts the "Spare" as the "Defective". I want to show in Datagridview that the defective is "0" if it is not existed. To prevent the computation of spare as defective.

What I have tried:

Dim Activeqty As Integer
        Dim Spareqty As Integer
Dim defectqty As Integer

Activeqty = DataGridView1.Rows(0).Cells(1).Value.ToString()
defectqty = DataGridView1.Rows(1).Cells(1).Value.ToString()
Spareqty = DataGridView1.Rows(2).Cells(1).Value.ToString()



Activepercentage = Activeqty * 0.1
If Actprcnt > defectqty Then
    CriticalReport.Listview.Items.Add("CRITICAL")
End If

解决方案

Please, refer this: SQL Tip: COUNTing NULL values – Benjamin's blog[^]


这篇关于如何显示或计算空值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆