I am creating a crystal report that will display a number of counts. This works fine so long as I'm not using date parameters to narrow the results. The moment I try to use dates, my report returns 0 for all counts.
The report uses a command object with the following SQL (obfuscated, but syntactically the same).
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
If I replace the parameters with static values in the command itself, it runs perfectly... But any attemps I've made to use date parameters causes it to fail. I think that it might be that the crystal report is providing a date in a format is intelligable to the ms sql server. I've tried casting, but nothing seems to work. How can I get my date parameters to work?