Reputation: 6410
I have an SSRS report to which I am passing a Start Date and End Date parameter but I keep receiving the following error:
Procedure or function 'MyReport' expects parameter '@startDate', which was not supplied.
I have created a parameter in my report and mapped it in my DataSet. I do not understand what I'm missing here. Any ideas? Any help is much appreciated.
SQL
ALTER PROCEDURE [dbo].[MyReport]
@startDate datetime,
@endDate datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT *
FROM myReportTbl tbl
WHERE tbl.[Updated] >= @startDate
AND tbl.[Updated] <= @endDate
END
Report Code
<DataSet Name="DataSet1">
<Query>
<DataSourceName>Dev</DataSourceName>
<QueryParameters>
<QueryParameter Name="@startDate">
<Value>=Parameters!StartDate.Value</Value>
<rd:UserDefined>true</rd:UserDefined>
</QueryParameter>
<QueryParameter Name="@endDate">
<Value>=Parameters!EndDate.Value</Value>
<rd:UserDefined>true</rd:UserDefined>
</QueryParameter>
</QueryParameters>
<CommandText>MyReport</CommandText>
</Query>
Upvotes: 8
Views: 7281
Reputation: 317
In Visual Studio 2015, in the Report Data window, expand Datasets, then right click on your dataset to select Dataset Properties.
In the Dataset Properties, ensure both Query and Parameters has added the required fields, either one missing will throw you this error.
Upvotes: 0
Reputation: 6410
I found the issue. It was pretty dumb of me but I swear I'd done this in the past. I had set the Query Type
in the dataset to Text
and it should be Stored Procedure
.
Upvotes: 5
Reputation: 1030
Try Deleting the parameters and then going into the dataset properties and hit refresh fields, that should recreate them for you.
Upvotes: 2
Reputation: 3760
Check that the case of the parameters is correct. I've received errors in the past due to case issues.
Report parameters are case-sensitive.
https://msdn.microsoft.com/en-us/library/ms155391.aspx
Upvotes: 2