水晶报表异常和常规报错处理之总汇

来源:互联网 发布:斯塔克大厦数据 编辑:程序博客网 时间:2024/05/22 11:48

从网上搜索到这样的文章:

there   is   a   registry   key   setting-  
  HKEY_LOCAL_MACHINE;SOFTWARE;Crystal   Decisions;10.0;Report   Application  
  Server;InprocServer;PrintJobLimit(defaul  
  t   75)  
   
  You   can   increase   this   size.   There   are   two   registry   keys   both   under   the  
  Report   Application   Server.   The   InprocServer   sets   the   limit   for   the   number  
  of   "open"   reports   even   if   you're   not   explicitly   using   the   RAS   (i.e.   just  
  using   the   .NET   Report   Document   component   or   CrystalViewer   control-   the  
  crystal   engine   *is*   using   the   RAS   behind   the   scenes).   If   you're   using   the  
  RAS   explicitly,   then   you   can   set   the   same   key   under   CrystalDecisions;Report  
  Application   Server;Server;PrintJobLimit  
   
  Also,   I   was   not   "disposing"   of   my   report   objects   after   rendering   them   on   the  
  web   form.   In   the   Page_Unload   event,   I   implemented   the  
  ReportDocument1.Dispose()   method   (not   suggested/mentioned   in   any   of   the  
  sample   code   I   have   found   or   any   of   the   books   on   crystal.NET   I   have   read)  
   
  I   have   not   had   the   problem   since   making   these   changes.   I   was   cautioned  
  against   raising   the   PrintJobLimit   too   high,   however,   as   this   can   eventually  
  lead   to   serious   performance   issues,   so   be   careful  。

经过反复分析才知道有几种办法:

A.具体为修改下面两个键的值。  
  HKEY_LOCAL_MACHINE;SOFTWARE;Crystal   Decisions;10.0;Report   Application  
  Server;InprocServer;PrintJobLimit  
   
  修改为1000  
  还有一个HKEY_LOCAL_MACHINE;SOFTWARE;Crystal   Decisions;10.0;Report   Application  
  Server;Server;PrintJobLimit   也修改为1000

B.装企业版的水晶报表

本人通过A项方案解决水晶报表此异常,B项也是网上大家都议论着的!推荐使用!

二.用户使用水晶报表的时候出现加截报表错误:

刚开始用户使用非常正常,但使用一天(该用户使用报表频率非常大)就会出现"报表加载失败",然后用户重启服务器这后又可以了,具体信息出错请看下截屏
   我发现在C:/WINDOWS/Temp这个临时文件里面有大量的水晶报表文件,每使用一次就会生成几个文件,在电脑没有重新启动的情况下它不会被删除,而出现大量的无用文件,在google里面搜了一圈发现也有人碰到这样的情况但回答的很模糊只是说要将水晶报表装载的文档关闭掉,从这里可以看出出现这样的错误应该是程序员人为照成的.
    具体解决如下:
          1.ReportDocumen实例必须为类成员    

private ReportDocument prtp = new ReportDocument();   



          2.使用完水晶报表必须关闭文件,这样子就不会在windows的临时文件里面产生.

    private void Page_Unload(object sender, EventArgs e)
    
{
        prtp.Dispose();
    }

             Page_Unload 事件是在页面完全显示的时候运行,这样子就解决了.


以上总汇内容参考:http://www.cnblogs.com/daxia/archive/2007/04/11/TonnerTang.html