Question

Locked

Database Connection to Crystal Report

By dilumd ·
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

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

How about something like...

by The 'G-Man.' In reply to Database Connection to Cr ...

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();

Collapse -

And be sure to test it, to make sure it's closing the DB

by robo_dev In reply to How about something like. ...

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.

Back to Windows Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums