Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2005, 05:58 PM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invalid parameter name: {0}

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);
}






Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter object malfunction - out parameter dash dev C# 2005 6 December 4th, 2007 12:58 PM
Help with Invalid bracketing of name Corey Access VBA 1 February 18th, 2006 06:13 AM
Invalid bracketing sasidhar79 SQL Language 1 July 13th, 2004 07:31 AM
Invalid use of property hanna VB.NET 2002/2003 Basics 1 March 31st, 2004 06:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.