Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Load Report Failed when Applying Current Values Post Reply Post New Topic
Author Message
cipheris
Newbie
Newbie
Avatar

Joined: 28 Oct 2008
Location: United States
Online Status: Offline
Posts: 24
Quote cipheris Replybullet Topic: Load Report Failed when Applying Current Values
    Posted: 04 Nov 2008 at 7:08am
Below is a copy of my code.  I am receiving a Load Report Failed at crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(values0);
 
Any ideas?
 
 
CrystalDecisions.Shared.ParameterDiscreteValue pdv = new CrystalDecisions.Shared.ParameterDiscreteValue();

CrystalDecisions.CrystalReports.Engine.ReportDocument crReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

crReport.FileName = "Report1.rpt"; ;

crReport.Load(@"C:\Apps\Web\TestCFML\" + crReport.FileName, OpenReportMethod.OpenReportByDefault);

//this.CrystalReportViewer1.ReportSource = Server.MapPath("report1.rpt");

this.CrystalReportViewer1.ReportSource = @"C:\Apps\Web\TestCFML\" + crReport.FileName;

ParameterValues values0 = new ParameterValues();

pdv.Value = "MIA";

values0.Add(pdv);

crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(values0);

ParameterValues values1 = new ParameterValues();

pdv.Value = DateTime.Now.AddDays(-6);

values1.Add(pdv);

crReport.DataDefinition.ParameterFields[1].ApplyCurrentValues(values1);

ParameterValues values2 = new ParameterValues();

pdv.Value = DateTime.Now;

values2.Add(pdv);

crReport.DataDefinition.ParameterFields[2].ApplyCurrentValues(values2);

ParameterValues values3 = new ParameterValues();

pdv.Value = "TEST";

values3.Add(pdv);

crReport.DataDefinition.ParameterFields[3].ApplyCurrentValues(values3);

carlos
IP IP Logged
cipheris
Newbie
Newbie
Avatar

Joined: 28 Oct 2008
Location: United States
Online Status: Offline
Posts: 24
Quote cipheris Replybullet Posted: 04 Nov 2008 at 10:05am
This line is actually not in the code: 
crReport.Load(@"C:\Apps\Web\TestCFML\" + crReport.FileName, OpenReportMethod.OpenReportByDefault);
 
I added this to see if it would resolve the issue.  It did not.

carlos
IP IP Logged
cipheris
Newbie
Newbie
Avatar

Joined: 28 Oct 2008
Location: United States
Online Status: Offline
Posts: 24
Quote cipheris Replybullet Posted: 04 Nov 2008 at 11:38am
I resolved the Load Report Probem.  Now I am having issues displaying the reports with the parameters.  Any ideas?  Below is how I resolved the Load Report Issue.
 

CrystalDecisions.Shared.ParameterDiscreteValue pdv = new CrystalDecisions.Shared.ParameterDiscreteValue();

CrystalDecisions.CrystalReports.Engine.ReportDocument crReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

crReport.FileName = Server.MapPath("Report1.rpt");

ParameterValues values0 = new ParameterValues();

pdv.Value = "MIA";

values0.Add(pdv);

crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(values0);

ParameterValues values1 = new ParameterValues();

pdv.Value = DateTime.Now.AddDays(-6);

values1.Add(pdv);

crReport.DataDefinition.ParameterFields[1].ApplyCurrentValues(values1);

ParameterValues values2 = new ParameterValues();

pdv.Value = DateTime.Now;

values2.Add(pdv);

crReport.DataDefinition.ParameterFields[2].ApplyCurrentValues(values2);

ParameterValues values3 = new ParameterValues();

pdv.Value = "TEST";

values3.Add(pdv);

crReport.DataDefinition.ParameterFields[3].ApplyCurrentValues(values3);

this.CrystalReportViewer1.ReportSource = crReport;

carlos
IP IP Logged
cipheris
Newbie
Newbie
Avatar

Joined: 28 Oct 2008
Location: United States
Online Status: Offline
Posts: 24
Quote cipheris Replybullet Posted: 04 Nov 2008 at 12:06pm
The above code solved my issues.
carlos
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.016 seconds.