Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Problem with Parameter report on deployment Post Reply Post New Topic
Author Message
Vamp10988
Newbie
Newbie


Joined: 12 Aug 2011
Online Status: Offline
Posts: 4
Quote Vamp10988 Replybullet Topic: Problem with Parameter report on deployment
    Posted: 08 Sep 2011 at 7:32am
Hello everyone, I'm not sure if this is a language specific forum but I am going to be posting 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();
            try
            {
               cryRpt.Load("../../JuvenileArrest.rpt");
              
            }

            catch
            {
            }

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;

            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = intCaseID;
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            
            crParameterFieldDefinition = crParameterFieldDefinitions["CaseID"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();

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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.