I have following problem using report builder in Visual Studio 2015: When I try to add date parameter (BETWEEN statement) into following code VS automatically changes them to question marks eg. @Datefrom -> '?'
SELECT DISTINCT au.FIRST_NAME AS 'Serwisant',
(SELECT COUNT(CHARGEID) AS Expr1
FROM ChargesTable AS ct
WHERE (TECHNICIANID = hdc.TECHNICIANID)
AND (DATEADD(s, DATEDIFF(s, GETUTCDATE(), GETDATE()) + TS_STARTTIME / 1000, '1970-01-01 00:00:00') BETWEEN DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0) AND DATEADD(s, - 1, DATEADD(mm, DATEDIFF(m, 0, GETDATE()) + 1, 0)) )
AND (CHARGEID IN (SELECT CHARGEID
FROM WorkOrderToCharge)
OR CHARGEID IN (SELECT CHARGEID
FROM TaskToCharge
WHERE (TASKID IN
(SELECT TASKID
FROM WorkOrderToTaskDetails))))) AS 'Ilosc wpisow'
FROM HelpDeskCrew AS hdc INNER JOIN
AaaUser AS au ON au.USER_ID = hdc.TECHNICIANID
My code has like 3 or 4 simillar blocks with 'between' statements and when i change them to parameters the VS changes all of them to '?' and gives me 10 werid parameter in report designers.
Thanks for help!
It seems that you want to do a report, where user would enter StartDate and EndDate parameters.
Assuming you have a Data Source, to achieve this you need to create a Data Set based on your query, like this:
SELECT BirthDate
FROM DimCustomer
WHERE BirthDate > @StartDate AND BirthDate < @EndDate
This will automatically create two parameters @StartDate and @EndDate. You may want to change this parameters to accept only datetime values.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.