SSRS Procedure or function “” expects parameter '', which was not supplied
Asked Answered
A

4

8

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>
Absorbed answered 24/8, 2015 at 19:11 Comment(2)
I opened up my code behind page and everything looks to be set correctly...Absorbed
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.Abstractionist
A
5

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.

Absorbed answered 24/8, 2015 at 21:33 Comment(1)
I'm having the same issue, but don't see where query type is set; in the Data tab I simply have "Stored procedure: " and then a dropdown. It was running until I changed the font weight on a Textbox in Layout view.Disturbing
E
2

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

Enolaenormity answered 24/8, 2015 at 19:36 Comment(2)
I've copy and pasted them directly from the stored proc.. also see picture.. This is a super annoying issue.Absorbed
@Absorbed You're right as I can't seem to recreate this issue. I setup a simple report exactly the same as you've stated above and am able to get it to run.Enolaenormity
B
2

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

Basham answered 24/8, 2015 at 20:26 Comment(0)
V
0

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.

Vasos answered 4/8, 2022 at 7:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.