Question Locked

Database Connection to Crystal Report

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Im using vb6 and MS-Access to develop a payroll system. Crystal report is used for reporting.

In that system, when a report loaded to screen, I noticed that database connection is not closed.

Can you please tell me how to close the database connection of the report as soon as report load to screen.

Thanks

3 replies

by the 'g-man.'

ReportDocument rd = (ReportDocument) viewer.ReportSource;
foreach (Table table in rd.Database.Tables)
table.Dispose();
viewer.ReportSource = null;
rd.Database.Dispose();
rd.Close();
rd.Dispose();
rd = (ReportDocument) viewer.ReportSource;
GC.Collect();

by robo_dev

I recall getting an angry call from a DBA a few years ago since my Crystal Report app had used up all the memory on the DB server with like 5,000 open connections.

This discussion is closed to new replies.