Crystal报表 - 关闭数据库连接

Crystal报表 - 关闭数据库连接

问题描述:

这是在C#,Visual Studio 2008中,水晶报表与VS2008来到

This is in C#, Visual Studio 2008, crystal reports that came with VS2008

我有驻留在DLL中的水晶报表查看器的形式。该DLL是负责加载水晶报表(根据报告文件名),并显示在表格上的报告。

I've got a crystal report viewer form that resides in a DLL. The DLL is responsible for loading the crystal report (based on report filename), and displaying the report on the form.

当我用水晶报表做的,我叫处置加载的ReportDocument对象。但是,数据库连接保持。

When I'm done with the crystal report, i call dispose on the loaded reportdocument object. However, the database connection remains.

水晶似乎检测,还有其他的连接(从我的主要应用程序)到同一个数据库,并保持其连接开放。当主应用程序的数据库连接关闭晶体连接被关闭。

Crystal seems to detect that there are other connections (from my main application) to the same database, and keeps its connection open. The crystal connection is closed when the main applications database connection is closed.

有没有办法强迫水晶关闭其连接,与出关的主要应用程序的数据库连接?

Is there any way to force crystal to close its connection, with out closing the main applications database connection?

你是如何连接到数据库,通过创建通过设置身份验证在运行自己的连接或者是你让水晶就通过在报表中存储的连接的连接?如果你是做以任何方式,形状或形式自己的连接,您必须手动关闭连接和处理报告之前调用Dispose。

How are you connecting to the database, by creating your own connection at runtime via setting the authentication or are you letting Crystal do the connection via the stored connection in the report? If you are doing your own connection in any way, shape, or form, you have to manually close the connection and call the dispose before disposing the report.

这是很可能这是一个内存泄漏。我以前都经历过这些。还有一个内存泄漏问题与水晶报表,并谈到了他们的论坛相当多,但没有发出补丁,当我在几年前使用它。我抛弃了水晶其他选项。

It is quite possible this is a memory leak. I have experienced these before. There is also a memory leak issue with Crystal Reports and is talked about on their forum quite a bit but no fix was issued when I was using it a few years ago. I ditched Crystal for other options.