954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Database connection remains open even after closing the crystal Report - Solved

For last couple of days I was going through this problem. Now I found the solution, so just thought that I would post here (Many of you might already know the solution, but still..... :) ).

I have a form having a Crystal report viewer control on it. After viewing the report and closing the form, I observed that the access database connection remained open (A .ldb file remained there in the data folder) even after closing the form. This .ldb file was causing problems while taking backup of my application with the error "Could not access .ldb file".

After searching forums, I could not get exact solution to this problem. Now I found one.

In the FormClosing event of my form that have the crystal report viewer, I added following code and it worked -

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
        myReport = CrystalReportViewer1.ReportSource
        myReport.Dispose()


Now, no more .ldb file after closing the crystal report viewer :)

ukshir
Newbie Poster
18 posts since Feb 2010
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: