Reputation: 1
I am not able to load this report based on the following code:
ReportDocument crystalReport = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "Param";
paramDiscreteValue.Value = TextBox1.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
crystalReport.SetDatabaseLogon("username","password","servername","db");
CrystalReportViewer1.ReportSource = crystalReport;
It just says "The report you requested requires further information." I am passing it the necessary parameters that the report requires as well as the username,pw,server, and db. Any suggestions would help. Thanks!
Upvotes: 0
Views: 2646
Reputation:
I'm in the middle of doing this myself, so I share your pain.
I have:-
CrystalReportSource1.ReportDocument.SetParameterValue(fieldNo, fieldValue);
Where fieldNo
has come from iterating over:-
CrystalReportSource1.ReportDocument.DataDefinition.ParameterFields
Which seems to work for my reports.
BTW Different versions have varying levels of pickiness over the type of fieldValue.
As Craig says, you need to set subreport parameters, although equally you need to make sure you don't set the value of linked parameters.
You can detect linked paramters with:-
bool linked = CrystalReportSource1.ReportDocument.DataDefinition.ParameterFields[fieldNo].IsLinked();
Upvotes: 3