我正在创建一个水晶报表,它将显示一些计数。只要我不使用日期参数来缩小结果范围,它就可以正常工作。当我尝试使用日期时,我的报告对所有计数都返回 0。
该报告使用具有以下 SQL 的命令对象(经过混淆处理,但语法相同)。
SELECT
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_SUBMITTED IS NOT NULL) AS SUBMITTED,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate}) AS TOTALRECEIVED,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate} AND STATUS_ LIKE 'A1') AS A1,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate} AND STATUS_ LIKE 'A2') AS A2,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate} AND STATUS_ LIKE 'A3') AS A3,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate} AND STATUS_ LIKE 'A4') AS A4,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate} AND STATUS_ LIKE 'A5') AS A5,
(SELECT COUNT(*) FROM REPORT_ WHERE DATE_RECEIVED BETWEEN {?StartDate} AND {?EndDate} AND STATUS_ LIKE 'OTHER') AS OTHER
如果我用命令本身中的静态值替换参数,它会完美运行......但是我使用日期参数所做的任何尝试都会导致它失败。我认为水晶报告提供的日期可能是ms sql server可以理解的格式。我试过铸造,但似乎没有任何效果。我怎样才能让我的日期参数工作?