【问题标题】:C# Report Renderer for SRSS 2008 R2 - Missing ParameterSRSS 2008 R2 的 C# 报告渲染器 - 缺少参数
【发布时间】:2013-01-22 20:21:23
【问题描述】:

我正在使用 C# 呈现来自 SRSS 2008 R2 的报告 该报告有参数,很长一段时间我在渲染输出时都没有问题。然而今天它决定它不工作了!

这是错误

ReportServerException: This report requires a default or user-defined value for the report parameter 'CustomFieldId'. To run or subscribe to this report, you must provide a parameter value. (rsReportParameterValueNotSet): Stack: at Microsoft.Reporting.WebForms.ServerReportSoapProxy.OnSoapException(SoapException e)

代码如下:

ReportViewer rv = new ReportViewer();
rv.ShowCredentialPrompts = true;
rv.ProcessingMode = ProcessingMode.Remote;
rv.ServerReport.ReportServerUrl = new Uri(ReportsClient.ReportServerUrl);
rv.ServerReport.ReportPath = string.Format("/Reports/{0}", item.Name);
rv.ServerReport.SetParameters(thisLoopParams.ToArray());
rv.ServerReport.Timeout = -1;
rv.ServerReport.Refresh();

// render the report
string mimeType = string.Empty;
string extention = string.Empty;
string encoding = string.Empty;
string[] streamIds;
Microsoft.Reporting.WebForms.Warning[] warnings = null;

byte[] result = rv.ServerReport.Render(outputFormat, deviceInfo, out mimeType, out encoding, out extention, out streamIds, out warnings);

如果我检查thisLoopParams,我可以清楚地看到'CustomFieldId'ReportParameter,它肯定有一个值,但错误仍然出现。

有什么想法吗?

【问题讨论】:

  • 尝试打开 rdl 并为该参数添加一个默认值。
  • 完成。可悲的是仍然遇到同样的错误

标签: c# ssrs-2008


【解决方案1】:

找到了。 我查看了ReportParameterInfoCollection paramInfo = rv.ServerReport.GetParameters();,发现其中一些参数“无效”。我知道为什么,但我有点被“未提供”的原始错误所抛弃。我猜这是因为我自豪的有效值我们只是打折了

谢谢

【讨论】:

  • 我用这种方法探索了我提供的参数;在我的情况下,我提交的 GUID 参数都是大写的,但有效值是小写的等效值。
【解决方案2】:


当我传递“XYZ”字段的值时,我遇到了同样的问题,但它说

此报告需要报告的默认值或用户定义的值 参数

当我看到 'XYZ' 的值时,它在启动时有额外的空间,当我删除这个空间时,它出人意料地开始工作。我不知道原因,但它有效。希望它可以帮助你。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-26
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多