crystal report

J

Jun

I am getting this error when i run a crystal report in
asp.net , i'm using commad with 1 parameter..

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details:
CrystalDecisions.CrystalReports.Engine.ParameterFieldCurren
tValueException: Missing parameter field current value.

Source Error:

An unhandled exception was generated during the execution
of the current web request. Information regarding the
origin and location of the exception can be identified
using the exception stack trace below.


I have the following code to pass the parameters:

CrystalDecisions.Shared.ParameterFields ParameterFields;

CrystalDecisions.Shared.ParameterField
ParameterField, ParameterField1, ParameterField2,
ParameterField3;

CrystalDecisions.Shared.ParameterDiscreteValue
ParameterDiscreteValue, ParameterDiscreteValue1,
ParameterDiscreteValue2, ParameterDiscreteValue3;
//Create a new ParameterFields
collection
ParameterFields = new
CrystalDecisions.Shared.ParameterFields();
//Creata a new ParameterField
object
ParameterField = new
CrystalDecisions.Shared.ParameterField();
ParameterField1 = new
CrystalDecisions.Shared.ParameterField();
ParameterField2 = new
CrystalDecisions.Shared.ParameterField();
ParameterField3 = new
CrystalDecisions.Shared.ParameterField();
//Assign the ParameterFieldName
property
ParameterField.ParameterFieldName
= "Year0";
ParameterField1.ParameterFieldName
= "Year1";
ParameterField2.ParameterFieldName
= "Year2";
ParameterField3.ParameterFieldName
= "province_id";
//Create a ParameterValue object
ParameterDiscreteValue = new
CrystalDecisions.Shared.ParameterDiscreteValue();
ParameterDiscreteValue1 = new
CrystalDecisions.Shared.ParameterDiscreteValue();
ParameterDiscreteValue2 = new
CrystalDecisions.Shared.ParameterDiscreteValue();
ParameterDiscreteValue3 = new
CrystalDecisions.Shared.ParameterDiscreteValue();
//Assign a value to the object
ParameterDiscreteValue.Value
= "2004";
ParameterDiscreteValue1.Value
= "2003";
ParameterDiscreteValue2.Value
= "2002";
ParameterDiscreteValue3.Value
= "1";
//Add the ParameterValue object to
either the CurrentValues or DefaultValues collection
ParameterField.CurrentValues.Add
(ParameterDiscreteValue);
ParameterField1.CurrentValues.Add
(ParameterDiscreteValue1);
ParameterField2.CurrentValues.Add
(ParameterDiscreteValue2);
ParameterField3.CurrentValues.Add
(ParameterDiscreteValue3);
//Add the ParameterField object to
the ParameterFileds collection
ParameterFields.Add
(ParameterField);
ParameterFields.Add
(ParameterField1);
ParameterFields.Add
(ParameterField2);
ParameterFields.Add
(ParameterField3);
//Assign the ParameterFields
collection to the viewer

CrystalReportViewer1.ParameterFieldInfo =
ParameterFields;


Any help is appreciated. Thanka in advance!


Jun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,800
Messages
2,569,657
Members
45,417
Latest member
BonitaNile
Top