获取“未指定运行报告所需的一个或多个参数"错误 [英] Getting a "one or more parameters required to run the report have not been specified" error
问题描述
我正在构建一个报告,我希望接受来自用户的两个值,将它们提供给查询,并找到与这些条目关联的数据.
I am building a report that I would like to accept two values from the user, feed those into a query, and find the data associated with those entries.
例如,如果您有一份员工、绩效指标和与之相关的价值观列表;然后用户将选择一个员工姓名/绩效指标,他们将获得该员工在该指标上的评分信息.
For example, if you had a list of employees, performance measures, and values associated with those; then the user would select an employee name / performance measure, and they would get the scoring information on that employee for that measure.
我有两个参数,每个参数都是从 SQL 查询填充的,获取员工姓名和度量的不同列表,下面的表格只是根据 ~ 'WHERE name = @Name AND measure = @Measure' 提取信息,但是当我单击预览"以在本地运行报告我收到错误消息:尚未指定运行报告所需的一个或多个参数"
I have two parameters, each being populated from SQL queries getting a distinct list of employee names and measures, and a table below that just pulls up information based on ~ 'WHERE name = @Name AND measure = @Measure' but when I click 'Preview' to run the report locally I get the error: "one or more parameters required to run the report have not been specified"
我知道参数工作正常,因为我可以将它们的值直接输入到文本框中,并且这些值可以正确填充.此外,如果我将查询更改为仅接受一个参数(即 WHERE measure = @Measure),则查询有效.
I know the parameters are working properly because I can feed their values directly into a textbox and the values populate correctly. Also, if I change the query to just accept one parameter (i.e. WHERE measure = @Measure) the query works.
我很困惑为什么会发生这个错误,因为我知道我的参数正在运行并且被正确填充.
I'm confused as to why this error is occurring since I know my parameters are functioning and being populated properly.
推荐答案
我在 .NET 4.0 中使用本地报告(在 .rdlc 文件中)遇到过这种行为,当时参数的值之一包含空字符串.虽然设置参数是正确的:
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.
这篇关于获取“未指定运行报告所需的一个或多个参数"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!