September 8th, 2011, 12:28 PM
Difficulty dealing with parameterized reports after deployment
Hello everyone, I realize that this is a VB forum and I am going to post C# code. I didn't see a C# crystal reports forum. I am having difficulty with reports that take parameters. I have a few reports that take primary key values as parameters. These values are automatically passed to the report via windows forms constructors. The code I have points to my report source in the development folder; however, when installation occurs, there no longer is a development folder and my reports do not load. Here is my code
ReportDocument cryRpt2 = new ReportDocument();
ReportDocument cryRpt = new ReportDocument();
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = intCaseID;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["CaseID"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crystalReportViewer1.ReportSource = cryRpt;
As you can see my report location "cryRpt" is located at "../../JuvenileArrest.rpt"
I tried to substitute the report source and crParameterFieldDefinitions = this.JuvenileArrest; instead and it worked in development but after deployment the program completely restarts itself with out any error message what so ever. When I had the report source set to "cryRpt" I got an error stating it could not locate the report and it is obvious because at the installation folder there is no .rpt file. I think those are located in some data file because all the other "non parameter" reports I have work flawleslly.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!