7
votes

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.

Param Mapping

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>
3
I opened up my code behind page and everything looks to be set correctly... - ExceptionLimeCat
Can you also show the screenshots of Parameter properties of StartDate and EndDate. Remember SSRS is case sensitive, so these type of errors can happen if you defined the parameter startDate and calling as StartDate. - Anup Agrawal

3 Answers

5
votes

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.

2
votes

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

2
votes

Try Deleting the parameters and then going into the dataset properties and hit refresh fields, that should recreate them for you.