Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disposing ReportObjects

Status
Not open for further replies.

organickarma

Programmer
Nov 19, 2006
34
US
Environment

Crystal Reports XI Release 2
Visual Studio 2005 ASP . NET 2.0
Windows Server 2003

I have integrated a report that has 2 subreports in it with an ASP . NET website.

I am using Table Adapters to populate dropdownlists for 4 parameters in a cascading manner

When method Parameter4_OnSelectedIndexChanged() is called a method filterReport() is called that sets the values selected to the parameters

The report viewer is called CrystalReportViewer1 and the ReportSource is CrystalReportSource1

These are created by default when I drag drop the viewer and reportsource controls from the toolbox

The site has built beautifully and everything works fine, but from experience I know that when 70 to 80 users are hitting the site the maximum report object creation limt is reached and the app crashes.

i placed this code in filterReport() as follows

protected bool filterReport()
{
CrystalReportSource1.ReportDocument.Close()
CrystalReportSource1.ReportDocument.Dispose()

// This is where I would like to create a new instance of object CrystalReportSource1

//I set the parameters after this

CrystalReportSource1.ReportDocument.SetParameterValue()

and so on

}

This obviously throws an object not set to instance of object exception.

My question is .. where do I place this garbage collection code so that it cleans up resources after browser is closed

OR

What is the way for me to recreate the CrystalReportSource1 object after i close and dispose the previous instance on calling filterReport()

Please HELP!!!
 
Is your Code-Behind in VB or C#? You might be better off asking this question in the appropriate programming forum:

C#
VB.NET

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top