如何将日期参数作为sql查询从ssrs报表传递到query.commandtext

如何将日期参数作为sql查询从ssrs报表传递到query.commandtext,sql,reporting-services,rdl,Sql,Reporting Services,Rdl,我正在尝试设置命令文本的表达式,如下所示: ="Database.dbo.pPROC 'FirstParameter', " + IIf(Parameters!Date.Value="","null", CDate(Parameters!Date.Value) ) 作为第二个参数,我需要传递报告(Parameters!Date.Value)中的日期/时间参数,以执行该过程。 sql中的第二个参数有一个smalldatetimeformat(f.e 2018-08-01 00:00:00) 当我

我正在尝试设置命令文本的表达式,如下所示:

="Database.dbo.pPROC 'FirstParameter', " + IIf(Parameters!Date.Value="","null", CDate(Parameters!Date.Value) )
作为第二个参数,我需要传递报告
(Parameters!Date.Value)
中的日期/时间参数,以执行该过程。 sql中的第二个参数有一个
smalldatetimeformat(f.e 2018-08-01 00:00:00)

当我不选择日期(null),但当我想在报告中选择日期时,命令会起作用,但输出时出现错误:

“处理数据集的CommandText表达式时出错 ……”


谢谢

别把事情弄得太复杂了

选择存储过程作为查询类型,而不是为命令文本构建表达式。在属性窗口的参数页面上,可以将存储过程的参数映射到报表参数或表达式