Crystal.Net parameter error...based on World Sales Report.rpt 
Author Message
 Crystal.Net parameter error...based on World Sales Report.rpt

Hi,  I am using Crystal Reports for Visual Studio .NET.  I am trying to make
an example report work.

The directions said add a parameter.  I went to the FieldExplorer, to
Parameter fields, and created a new one and gave it the name "Country".  I
dragged it to the report and then used the "Select Expert" and set the
formula to: "{Customer.Last Year's Sales} > $0.00 and {Customer.Country} =
{?Country}" as the directions said.

I added the code (marked by *):
using CrystalDecisions.Shared; *

override protected void OnInit(EventArgs e)
     // CODEGEN: This call is required by the ASP.NET Web Form Designer.
     DataBind(); *
     SetParameterFields(); *


  protected void SetParameterFields () *
       ParameterFields paramFields =
CrystalReportViewer1.ParameterFieldInfo; *
       ParameterField paramField = paramFields["Country"]; *
       ParameterValues curValues = paramField.CurrentValues; *
       ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
       discreteValue.Value = TextBox1.Text; *
       curValues.Add(discreteValue); *
       CrystalReportViewer1.ParameterFieldInfo = paramFields; *

The code breaks/errors at: ParameterField paramField =
paramFields["Country"]: + paramFields["Country"] {"Specified argument was
out of the range of valid values." } System.ArgumentOutOfRangeException

The line before that populates: ParameterFields paramFields =
CrystalReportViewer1.ParameterFieldInfo puts zero (0) objects into
paramFields according to watch variables.

So why?  The databind in init and then call to SetParameterFields doesn't
find my parameter placed on  the report ?

Thanks,    Jeff

Thu, 21 Oct 2004 03:15:03 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Crystal Reports 7.0 - Modify RPT File and generate RPT file at runtime

2. Crystal Reports: error loading .rpt file

3. Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion

4. Crystal Report based on SQL Server Stored Procedure with Parameters

5. World Sales Report ..

6. Crystal Report based on ADO.Net dataset prompts for database login

7. Crystal Report .Net Web Service ( Invalid length for a Base-64 string )

8. Crystal .NET Web based report against Oracle

9. Error in temp file in running crystal report for .net in


11. printing without crystal report or data report for non data base reports

12. How to pass parameter from VB.Net to Crystal Report


Powered by phpBB® Forum Software