除以0问题vb.net
我如何确保 PCTofSales 不为 0。
'gets the projected sales by dividing the currentsales by the percent of sales
Dim projectedye As New DataColumn
projectedye = New DataColumn("ProjSales", GetType(Double))
projectedye.Expression = "CurrentSales / (PCTofSales)"
How Can I make sure PCTofSales, is not 0.
'gets the projected sales by dividing the currentsales by the percent of sales
Dim projectedye As New DataColumn
projectedye = New DataColumn("ProjSales", GetType(Double))
projectedye.Expression = "CurrentSales / (PCTofSales)"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您使用的是 .NET 3.5:
请参阅此处:MSDN 文章 了解有关可在表达式中使用的函数的信息。
Assuming you're using .NET 3.5:
See here:MSDN's article for information about functions you can use inside the expression.
时,是否不能使用 IF THEN 来调用该函数?
当“[ASOFSales] / [YEsales]”
等于零或不适合除
Can you not use an IF THEN to call the function when:
"[ASOFSales] / [YEsales]"
equals zero or is inappropriate to divide?
对数据集运行更新,将所有 0 更改为 NULL,或者更改数据源以返回 NULL,而不是 PCTofSales/其他列中的 0。
Run an update on your dataset to change all 0's to NULLs OR change your datasource to return NULLs instead of 0s in the PCTofSales/other column(s).