![](/img/trans.png)
[英]Why am I getting failed to open connection in Crystal Reports method ExportToDisk
[英]Crystal reports ExportToDisk consumes a lot of time
我在C#中有一個控制台應用程序,可與Crystal報表一起使用。 我正在使用以下方式加載報告(僅一次):
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文件。 會導致什么呢? 電腦是一樣的,我什么都沒改變。 但是它不能正常工作。 有人可以幫忙嗎?
可能是數據庫運行緩慢嗎? (根據Adil的要求)
其他信息( 希望您不要介意 ):
ExportToDisk方法使Crystal實際執行數據庫查詢。 在這種情況下,最好的測試是直接執行查詢以查看需要多長時間。 根據需要進行調整。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.