Francis_B
asked on
Discrete Parameter not Working with .NET (C#)
Hi Experts,
Hi have a form that is made of a Crystal Report Viewer, and I'm trying to load a report into it.
The report loads, but witouth the Parameter field set to the value I assign in the code ... And if I hit Refresh, it will prompt me for the Discrete Value ...
Here's the code I use :
public ShippingReportViewer()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//Create an instance of the strongly-typed report object
crReportDocument = new FulFill();
//Get the collection of parameters from the report
crParameterFieldDefinition s = crReportDocument.DataDefin ition.Para meterField s;
//Access the specified parameter from the collection
crParameterFieldDefinition = crParameterFieldDefinition s["EventID "]; //This is the parameter in the report, a Number
//Get the current values from the parameter field. At this point
//there are zero values set.
crParameterValues = crParameterFieldDefinition .CurrentVa lues;
//Set the current values for the parameter field
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.V alue = 166; //I know, it's static, but its to test !!!
//Add the first current value for the parameter field
crParameterValues.Add(crPa rameterDis creteValue );
//All current parameter values must be applied for the parameter field.
crParameterFieldDefinition .ApplyCurr entValues( crParamete rValues);
//Set the viewer to the report object to be previewed.
crystalRV.ReportSource = crReportDocument;
}
Hi have a form that is made of a Crystal Report Viewer, and I'm trying to load a report into it.
The report loads, but witouth the Parameter field set to the value I assign in the code ... And if I hit Refresh, it will prompt me for the Discrete Value ...
Here's the code I use :
public ShippingReportViewer()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//Create an instance of the strongly-typed report object
crReportDocument = new FulFill();
//Get the collection of parameters from the report
crParameterFieldDefinition
//Access the specified parameter from the collection
crParameterFieldDefinition
//Get the current values from the parameter field. At this point
//there are zero values set.
crParameterValues = crParameterFieldDefinition
//Set the current values for the parameter field
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.V
//Add the first current value for the parameter field
crParameterValues.Add(crPa
//All current parameter values must be applied for the parameter field.
crParameterFieldDefinition
//Set the viewer to the report object to be previewed.
crystalRV.ReportSource = crReportDocument;
}
ASKER
Hi BriCrowe,
hum.. this command does not exist when I type crReportDocument ... can it be a version problem?
Thanks,
Francis
hum.. this command does not exist when I type crReportDocument ... can it be a version problem?
Thanks,
Francis
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mlmcc - I have both Crystal Reports 9.2 and the version included in .NET ... Now this report has been created directly in .NET,
but I noticed that the VERSION property of the CRYSTALREPORTS.ENGINE reference is 9.2.3 ... Can it affect something?
- I will try the SAVE DATA WITH REPORT not checked issue now, using the CrystalReports 9.2.3 (this is not availlable in CrystalReport .NET, I think ...)
Thanks for your help
but I noticed that the VERSION property of the CRYSTALREPORTS.ENGINE reference is 9.2.3 ... Can it affect something?
- I will try the SAVE DATA WITH REPORT not checked issue now, using the CrystalReports 9.2.3 (this is not availlable in CrystalReport .NET, I think ...)
Thanks for your help
ASKER
... and you were RIGHT !!! The SAVE DATA WITH REPORT was checked !
Great ! I can now call this report with the associated Event ID !
Thanks alot mlmcc, this was a tricky one ! (well.....for me!)
Francis.
Great ! I can now call this report with the associated Event ID !
Thanks alot mlmcc, this was a tricky one ! (well.....for me!)
Francis.
I bet SAVE DATA WITH REPORT is the default. To change that
Open Crystal with no report
Click FILE --> OPTIONS
Uncheck the SAVE DATA WITH REPORT option
Glad i could help
mlmcc
Open Crystal with no report
Click FILE --> OPTIONS
Uncheck the SAVE DATA WITH REPORT option
Glad i could help
mlmcc
crReportDocument.SetParame