2012-09-22 14 views
1

我在C#與水晶報表工作的控制檯應用程序。我加載報告(僅一次)使用:Crystal報表ExportToDisk消耗了大量的時間

static ReportDocument cryReportDocument = new ReportDocument(); 

    static void Main(string[] args) 
    {    
     cryReportDocument.Load("reportLocation"); 
     .... 
     //I am exporting about 20.000 .pdf files 
     while(true) 
     { 
      .... 
      //destianationPath is file location 
      ExportToPdf(destinationPath) 
     } 
    } 

然後我使用本報告導出爲PDF文件:

//Export pdf file 
    static void ExportToPdf(string destianationPath) 
    {      
     cryReportDocument.SetDatabaseLogon("userName", "password", "Database", ""); 
     //Adding paremeters to report 
     cryReportDocument.SetParameterValue(.., ..);  
     //This line consumes a lot of time now 
     cryReportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, destianationPath); 
    } 

我使用之前這個程序(大約兩三天前)出口約15.000個.pdf文件,它工作得很好。在大約一秒內導出一個.pdf文件。我沒有改變我的代碼,但該行大約需要5秒鐘才能導出一個.pdf文件。這可能導致什麼?電腦是一樣的,我什麼也沒變。但它不能正常工作。誰能幫忙?

+1

難道說是緩慢的數據庫? – user1378730

+0

沒有,只有行會消耗大量的時間 –

+0

接近容量或磁盤高度分散的? – user1378730

回答

1

難道說是緩慢的數據庫? (阿迪爾的要求)


附加信息(希望你不介意):

的ExportToDisk方法使晶體實際執行數據庫查詢。在這種情況下,最好的測試是直接執行查詢來查看需要多長時間。必要時進行調整。