c# - IIF 声明未按预期运行

标签 c# reporting-services ssrs-2012 rdlc

=IIF(Fields!Date.Value = "", "Some Text", Fields!Date.Value)

我在报告中有上述语句,如果 date 值为 NULL,那么这将返回“Some Text”,而不是返回 date date 字段有一个值 我得到 #error

我对表达式的理解是,如果满足条件返回“Some Text”否则返回Fields!Date.Value

为什么会出现错误?

最佳答案

像这样做

=IIF(Fields!Date.Value Is Nothing, "No Value", Fields!Date.Value)

IIF() 语句具有以下格式:

=IIF( Expression to evaluate,
         what-to-do when the expression is true,
         what-to-do when the expression is false )
  • Parameter1:它应该是一个Boolean Expression
  • Paremeter2:当 Expressiontrue 时,将返回此值。
  • Paremeter3:当Expressionfalse时,该值将返回。

关于c# - IIF 声明未按预期运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53518729/

相关文章:

c# - 如何将一些 using 语句设置为不冗余,即使它们是冗余的?

sql-server - 对于 Chrome 和 IE 上的某些用户,日期选择器在 SSRS 报告中不可见

c# - 在 c#.net 中的两个网格中拆分一个 Gridview

c# - 根据其属性之一从 C# 列表中删除重复项

c# - 如何在 windows azure 上使用 asp.net 成员(member)资格?

reporting-services - Tablix 中的 SSRS 停止组被拆分为多个打印页面

sql - SSRS根据行总数计算列的百分比

reporting-services - 是否有可能在 SSRS 中部署单个报告

.net - 如何在 ssrs 的报告服务器中手动上传 rdl 文件。

reporting-services - SSRS中Tablix列的动态宽度调整