cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalReports ReportDocument in .net keeps database connections in sleeping mode in SQL

Former Member
0 Kudos

Hi,

I have a windows service written in C# which exports PDF reports. After successful execution of process, I see that there is last connection always left in database in sleeping mode. As i have hundreds of report, the sleeping connections keep on piling in database causing instability.

I use Crystal Reports for .NET Framework 4.0 version 13.0.2000.0 and Runtime version v2.0.50727

I get the sleeping connection for the last procedure in crystal report, when the following line runs

ReportDocument.Export(exportOptions);

Is it a known bug that crystal report leaves the last connection in database? I didn't found any forceful logoff method in C# to close the connection. Appreciate your help on this.

Thanks

View Entire Topic
DellSC
Active Contributor
0 Kudos

In addition to what Don said, are you explicitly disposing of the ReportDocument after you export it?

Some of the Crystal SDK is still based on COM objects, which .NET doesn't memory manage very well, so you have to either use the ReportDocument in a "using" clause that will automatically dispose of it when you're done using it or you have to explicitly call .Dispose() on it when you're done with it. This should cause the report to disconnect from the database and free up any memory that it's using.

-Dell