问题
I'm using C# to render a report from SRSS 2008 R2 The report has parameters and for a long time I have had no problem rendering the output. However today it has decided its not going to work!
Here is the error
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)
Here is the code:
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);
If I inspect thisLoopParams
I can clearly see the 'CustomFieldId' ReportParameter
and it definitely has a value, yet the error still appears.
Any ideas?
回答1:
Found it.
I took a look at ReportParameterInfoCollection paramInfo = rv.ServerReport.GetParameters();
and found some of the parameters were 'Not Valid'. I know why but i was a bit thrown out by the original error of 'Not Provided'. I'm guessing this is because the valids i proided we just discounted
Thanks
回答2:
I am facing the same issue when i pass value of 'XYZ' field but it says
This report requires a default or user-defined value for the report parameter
when i see the value of 'XYZ' it has extra space in starting when i removed this space it surprisingly starts working.I don't know the reason but it works.Hope it may help you.
来源:https://stackoverflow.com/questions/14749348/c-sharp-report-renderer-for-srss-2008-r2-missing-parameter