Wrox Programmer Forums
|
BOOK: Professional Crystal Reports for VS.NET
This is the forum to discuss the Wrox book Professional Crystal Reports for Visual Studio .NET by David McAmis; ISBN: 9780764544033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Crystal Reports for VS.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 15th, 2005, 08:06 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to subhan Send a message via Yahoo to subhan
Default Urgent Information Required For reporting

Dear forum members .........


I am using crystal Report 10 for my reporting process.This reports contains multitple detail
sections and multiple subreports which are link with each other.My task is to make such an application which automatically hit a table in SQL server database in a particular time interval, as it get the record then it generate crystal report and then export it into Pdf format. All of this work is done through Windows Service.

The problem i am facing is that when my method load the report its taking 100% CPU usage.

How i can reduce this amount of CPU usage?


Method for loding report is a follows:

public static ReportDocument prepareReport(string ID)

{


ReportDocument crReportDocument,crSubreportDocument;

Sections crSections;


SubreportObject crSubreportObject;

ReportObjects crReportObjects;

ConnectionInfo crConnectionInfo;

Database crDatabase;

Tables crTables;

TableLogOnInfo crTableLogOnInfo;

crReportDocument = new ReportDocument();

crReportDocument.Load(ConfigurationSettings.AppSet tings["PathMainReport"].ToString(),CrystalDecisions.Shared.OpenReportMeth od.OpenReportByTempCopy);

crDatabase = crReportDocument.Database;

crTables = crDatabase.Tables;

crConnectionInfo = new ConnectionInfo();

crConnectionInfo.ServerName = "FURQAN";

crConnectionInfo.DatabaseName = "flyingeagles";

crConnectionInfo.UserID ="crystal";

crConnectionInfo.Password = "cr";

foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in crTables)

{

crTableLogOnInfo = aTable.LogOnInfo;

crTableLogOnInfo.ConnectionInfo = crConnectionInfo;

aTable.ApplyLogOnInfo(crTableLogOnInfo); }

// THIS STUFF HERE IS FOR REPORTS HAVING SUBREPORTS

// set the sections object to the current report's section

crSections = crReportDocument.ReportDefinition.Sections;

// loop through all the sections to find all the report objects

foreach (Section crSection in crSections)

{

crReportObjects = crSection.ReportObjects;

//loop through all the report objects in there to find all subreports

foreach (ReportObject crReportObject in crReportObjects)

{

if (crReportObject.Kind == ReportObjectKind.SubreportObject)

{

crSubreportObject = (SubreportObject) crReportObject;

//open the subreport object and logon as for the general report

crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName);

crDatabase = crSubreportDocument.Database;

crTables = crDatabase.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in crTables)

{

crTableLogOnInfo = aTable.LogOnInfo;

crTableLogOnInfo.ConnectionInfo = crConnectionInfo;

aTable.ApplyLogOnInfo(crTableLogOnInfo);

}

}

}

}

crReportDocument.SetParameterValue("customer",1);

crReportDocument.SetParameterValue("@BookingID",ID );

//crReportDocument.SetParameterValue("ID",ID);


//crReportDocument.SaveAs(ConfigurationSettings.AppS ettings["PathAdminReport"].ToString()+"//Invoice_"+ID+".rpt");





CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new DiskFileDestinationOptions();


CrystalDecisions.Shared.DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();


crReportDocument.ExportOptions.ExportDestinationTy pe=CrystalDecisions.Shared.ExportDestinationType.D iskFile;

crReportDocument.ExportOptions.ExportFormatType=Cr ystalDecisions.Shared.ExportFormatType.PortableDoc Format;


DiskOpts.DiskFileName = ConfigurationSettings.AppSettings["PathAdminReport"].ToString()+"//Invoice_"+ID+".pdf";


crReportDocument.ExportOptions.DestinationOptions= DiskOpts;

crReportDocument.Export();



return crReportDocument;

}



Please reply soon..



Abdus Subhan







Abdus Subhan
 
Old October 8th, 2005, 12:05 PM
Registered User
 
Join Date: Oct 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Placement of your subreport makes a HUGE difference.

If you place the subreport in the Report header. The subreport is calculated once per report.

If you place it in the subreport in the section details, the subreport will calculate (along with the hit to the database) with each line in the section. this will cause a huge overhead.



Dwayne http://www.adacprogramming.com
http://www.topwebsitetips.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
how I can search required information form table GeoIrshad Access VBA 1 March 13th, 2008 06:31 AM
Ejb WeblogicBuilder information Required satyaprakash22 EJB 0 December 10th, 2007 02:28 PM
information ( urgent ) jameel SharePoint Admin 2 December 7th, 2007 01:58 AM
Exception Absolute Path Information required roydaniel .NET Framework 2.0 1 June 19th, 2006 04:38 PM
Urgent help required! mani84 ADO.NET 1 May 19th, 2006 02:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.