C# 检查RDLC中的参数是否为空

C# 检查RDLC中的参数是否为空,c#,rdlc,C#,Rdlc,我创建了一个报表查看器,并向其发送了一个参数,但如果该参数为null,则会显示错误。我试过这个: =IIf(IsNothing(Parameters!frompay.Value),"Empty",FormatDateTime(Parameters!frompay.Value,DateFormat.ShortDate)) 但问题依然存在。IIf执行真分支和假分支 因此,FormatDateTimeParameters!frompay.Value,DateFormat.ShortDate尝试将n

我创建了一个报表查看器,并向其发送了一个参数,但如果该参数为null,则会显示错误。我试过这个:

 =IIf(IsNothing(Parameters!frompay.Value),"Empty",FormatDateTime(Parameters!frompay.Value,DateFormat.ShortDate))
但问题依然存在。

IIf执行真分支和假分支

因此,FormatDateTimeParameters!frompay.Value,DateFormat.ShortDate尝试将null/Nothing格式化为失败的日期

您可能需要执行以下操作:

=IIf(IsDate(Parameters!frompay.Value), FormatDateTime(
CDate(iif(isdate(Parameters!frompay.Value),Parameters!frompay.Value,"01/01/1900")),
DateFormat.ShortDate),
"Empty")

文本框类似于此错误frompay?DateTime的类型是什么?我从数据时间选择器获取它是否有帮助?