<legend id='6arXF'><style id='6arXF'><dir id='6arXF'><q id='6arXF'></q></dir></style></legend><tfoot id='6arXF'></tfoot>

<small id='6arXF'></small><noframes id='6arXF'>

      <bdo id='6arXF'></bdo><ul id='6arXF'></ul>
      <i id='6arXF'><tr id='6arXF'><dt id='6arXF'><q id='6arXF'><span id='6arXF'><b id='6arXF'><form id='6arXF'><ins id='6arXF'></ins><ul id='6arXF'></ul><sub id='6arXF'></sub></form><legend id='6arXF'></legend><bdo id='6arXF'><pre id='6arXF'><center id='6arXF'></center></pre></bdo></b><th id='6arXF'></th></span></q></dt></tr></i><div id='6arXF'><tfoot id='6arXF'></tfoot><dl id='6arXF'><fieldset id='6arXF'></fieldset></dl></div>

      水晶报表——关闭数据库连接

      时间:2023-07-09
          <tbody id='V1hBf'></tbody>

        <small id='V1hBf'></small><noframes id='V1hBf'>

              <bdo id='V1hBf'></bdo><ul id='V1hBf'></ul>

              • <legend id='V1hBf'><style id='V1hBf'><dir id='V1hBf'><q id='V1hBf'></q></dir></style></legend>
                <i id='V1hBf'><tr id='V1hBf'><dt id='V1hBf'><q id='V1hBf'><span id='V1hBf'><b id='V1hBf'><form id='V1hBf'><ins id='V1hBf'></ins><ul id='V1hBf'></ul><sub id='V1hBf'></sub></form><legend id='V1hBf'></legend><bdo id='V1hBf'><pre id='V1hBf'><center id='V1hBf'></center></pre></bdo></b><th id='V1hBf'></th></span></q></dt></tr></i><div id='V1hBf'><tfoot id='V1hBf'></tfoot><dl id='V1hBf'><fieldset id='V1hBf'></fieldset></dl></div>
                <tfoot id='V1hBf'></tfoot>
                本文介绍了水晶报表——关闭数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                这是在 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.

                当我完成水晶报表时,我在加载的报表文档对象上调用 dispose.但是,数据库连接仍然存在.

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

                Crystal 似乎检测到(从我的主应用程序)到同一个数据库的其他连接,并保持其连接打开.当主应用程序数据库连接关闭时,水晶连接关闭.

                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?

                推荐答案

                标记代码似乎在一定程度上缓解了这种情况,虽然它有点倒退,应该是这样的:

                Marks code seems to somewhat relieve the situation although it is a bit backwards, should be something like:

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

                这对我来说并没有完全堵住漏洞,但确实有帮助.

                This didn't completely plug the leak for me but certainly helped.

                这篇关于水晶报表——关闭数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在 ASP.NET 中使用 Crystal Reports? 下一篇:.NET Framework 4.0 中的水晶报表

                相关文章

              • <i id='6wqph'><tr id='6wqph'><dt id='6wqph'><q id='6wqph'><span id='6wqph'><b id='6wqph'><form id='6wqph'><ins id='6wqph'></ins><ul id='6wqph'></ul><sub id='6wqph'></sub></form><legend id='6wqph'></legend><bdo id='6wqph'><pre id='6wqph'><center id='6wqph'></center></pre></bdo></b><th id='6wqph'></th></span></q></dt></tr></i><div id='6wqph'><tfoot id='6wqph'></tfoot><dl id='6wqph'><fieldset id='6wqph'></fieldset></dl></div>

                <small id='6wqph'></small><noframes id='6wqph'>

                    <bdo id='6wqph'></bdo><ul id='6wqph'></ul>
                  <tfoot id='6wqph'></tfoot>
                  <legend id='6wqph'><style id='6wqph'><dir id='6wqph'><q id='6wqph'></q></dir></style></legend>