Hi,

if the report is designed from SQL command with parameters below code is
not working and gives Error Invalid parameter name: {0}.

I have a report designed from SQL command and this main report has subreport
with different SQL command and both SQL commands has parameters. I can pas the
parameter to main report but it is not passing parameter to subreport.

If I do not pass the parameter to subreport it says that report needs more
information with parameter name and name of subreport. If I try to pass it
then it says Error Invalid parameter name: {0}.

Let say main report is designed from SQL command with parameters, and subreport
has parameters, but just to display, say date and same subreport is also
designed from SQL command, but SQL command does not have any parameter
but subreport has the date parameter just to display for testing porpuse.
This way main report gets the parameter again and also subreport too.

I even try with main has no parameter but subreport SQL command has parameter
even also that report is not working.

So if the report is designed from SQL command with parameters below code is
not working and gives Error Invalid parameter name: {0}.

Thanks for help

......
......
setDiscreteParameterValue(oFields, paramName, subReportName, userString);
session.setAttribute("parameterFields", oFields);
CrystalReportViewer oCrystalReportViewer = new CrystalReportViewer();
oCrystalReportViewer.setReportSource(reportSource) ;
oCrystalReportViewer.setOwnPage(true);
oCrystalReportViewer.setOwnForm(true);
oCrystalReportViewer.setPrintMode(CrPrintMode.PDF) ;
oCrystalReportViewer.setEnableParameterPrompt(true );
Fields parameterFields = (Fields)session.getAttribute("parameterFields");
oCrystalReportViewer.setParameterFields(parameterF ields);
oCrystalReportViewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
......
......

public void setDiscreteParameterValue(Fields oFields, String paramName, String reportName, Object value) {
ParameterField oParameterField = new ParameterField();
oParameterField.setReportName(reportName);
Values oValues = new Values();
ParameterFieldDiscreteValue oParameterFieldDiscreteValue = new ParameterFieldDiscreteValue();
oParameterField.setName(paramName);
oParameterFieldDiscreteValue.setValue(value);
oValues.add(oParameterFieldDiscreteValue);
oParameterField.setCurrentValues(oValues);
oFields.add(oParameterField);
}