Getting a “one or more parameters required to run the report have not been specified” error

ε祈祈猫儿з 提交于 2019-11-30 11:06:07

I experienced this behavior in .NET 4.0 using Local Reports (in .rdlc files), when one of the parameter's values was containing an emtpy string. Although setting the parameter was correct:

  report.SetParameters(
            new List<ReportParameter> {
                new ReportParameter("Title", Messages.Title),
                new ReportParameter("SubTitle", Messages.Subtitle))
            }
            );

It worked only as long as both parameters actually contained some characters, otherwise the mentioned exception was thrown.

This caused me many hours of pain. Turns out that it's to do with using a shared dataset. Embed the dataset within your report instead and it works fine.

user2121425

This error is caused when you either

A) the parameter is spelled wrong in the actual report. Meaning that the query is expecting @Name but the report is passing @Names (or some other spelling).

or

B) Is it possible you are attempting to run the report with a default value on the parameter of NULL for @Name but the stored procedure requires an actual value?

This might be happening if you are building the report in Visual Studio and gave the @Name parameter a default value of (null).

Try removing the default value or making sure you @Name parameter has an actual value, even if it's just ''.

I had similar issue. Issue happened when you use SharedDataSource with parameters that are to have null value. If you use same query in embeded data source, there is no problem.

Unlike embebed data source, you have to define if parameters used in query of shared data sources are allowed to have null value as highlighted in screenshot here. In my case, there are two parameters in query of shared data source, that can have null value.

So after setting them to allow null, problem fixed!

I was having the same problem, it is now sorted on sql server 2008 r2.

I know this is now an old question, but just to help others:

It was very simple really, just making sure the spelling including the case is the same and the use of @.

I have a shared dataset called currentSpaceByDrive with the following code:

SELECT 
   [DRIVE]
  ,[Volume_Size_GB]
  ,[VolumeSpaceAvailable_GB]
  ,[VolumePercentAvailable]
FROM  monitoring.dbo.currentSpaceByDrive(@ServerID)

I add the shared dataset currentSpaceByDrive to my report and I give it the same name. when I right click on it, the one on my report, dataset properties, the parameter is @ServerID.

@ServerID value comes from another dataset, called the_servers (where the user selects a serverID)

I have a report parameter also called @ServerID that gets its value from the_servers and is used to feed the @ServerID parameter on currentSpaceByDrive.

Too many @ServerID, I understand, but if you do your own test based on this, you will get it done. See the image attached.

hope this helps marcelo

check DataSet In Report Server , I had Similar Problem , I was Editing Shared Dataset in Visual Studio , but it didn't work , after an hour of frustration I checked dataset in report server and I found out it Is not updating with changes I made in visual studio , I Delete it and Redeploy Dataset Again from visual studio . it works .

Actually I had to:

  • Delete the SubReport object from the report.
  • Drag new object from Toolbox
  • Setup the SubReport name and report
  • In Paramateres "Add", and choose each parameter, and related value.

Then is works for me.

For me, setting the value of the parameter makes problem. I don't know why, but the parameter value was not able to accept a string.Empty or null. So i just gave a " " as value solves the error.

Sample

ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("Name", EName);
parameters[1] = new ReportParameter("ShiftName", CurrentShift);
parameters[2] = new ReportParameter("Date", LoginDate);
if(ValidateReportData())//some condition
{
    parameters[3] = new ReportParameter("Date1", LoginDate);
}
else
{
    //parameters[3] = new ReportParameter("Date1", string.Empty);//this makes exception while calling Render function.
    parameters[3] = new ReportParameter("Date1", " ");//Solves the issue.
}

I think I have same issue my Parameter Supervisor is blank when I choose "Select All" which causes the error "One or more parameters were not specified for the subreport", but if I select a few supervisor name then the sub-report appears. It is puzzling because the Manager parameter value shows all value when "Select All" is checked, but it is not working on my Supervisor parameter. Note that Supervisor parameter is dependent on manager parameter.

I'm using shared DataSets for several reports, and the root cause of this issue was not mapping the input parameters from the report itself to the parameters of the shared dataset.

To fix, I navigated to the "Report Data" panel, opened the dataset (which is really linking to a shared dataset), clicked the "Parameter" tab, and then mapped the report parameters to the parameters of the shared dataset.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!