簡體   English   中英

首次運行時報告加載時間太長

[英]Report takes too long to load when first run

當我調試項目並查看報告時,加載時間太長-至少需要一兩分鍾。 當我重新加載相同的報告並再次運行時,它可以正常工作,而無需加載時間。 如何減少加載時間?

ReportDocument reportDocument = new ReportDocument();
TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
TableLogOnInfo tableLogOnInfo = new TableLogOnInfo();
ConnectionInfo connectionInfo = new ConnectionInfo();
try
{
    string startupPath = Application.StartupPath;
    string filename;
    filename = startupPath + "\\Report\\" + rptSettings;
    reportDocument.Load(filename);
}
catch (Exception ex)
{
    KryptonMessageBox.Show(ex.Message, "Error Occured", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
}
connectionInfo.ServerName = Program.serverName;
connectionInfo.DatabaseName = Program.dbName;
connectionInfo.UserID = Program.saName;
connectionInfo.Password = Program.pw;
Tables tables = reportDocument.Database.Tables;
foreach (Table table in tables)
{
    tableLogOnInfo = table.LogOnInfo;
    tableLogOnInfo.ConnectionInfo = connectionInfo;
    table.ApplyLogOnInfo(tableLogOnInfo);
}

string month = "";
month = BillingMonth + " " + DateTime.Now.Year;
reportDocument.SetParameterValue("dueDate", paraDue);
reportDocument.SetParameterValue("feeMonth", BillingMonth);
reportDocument.SetParameterValue("tuitionFee", TutionFee);
reportDocument.SetParameterValue("TotalFee", Total);
reportDocument.SetParameterValue("issueDate", Total);
reportDocument.SetParameterValue("class", Total);
reportDocument.SetParameterValue("fatherName", Total);
reportDocument.SetParameterValue("studentName", Total);
reportDocument.SetParameterValue("annualCharges", Total);
reportDocument.SetParameterValue("validTill", Total);
reportDocument.SetParameterValue("ArrearsFee", Total);
reportDocument.SetParameterValue("JunJulFee", Total);
reportDocument.SetParameterValue("Fine", Total);
reportDocument.SetParameterValue("Discount", Total);
//reportDocument.RecordSelectionFormula = "{tblRegistration.id}=" + ID;

try
{
    if (!printAll)
    {
        crystalReportViewer1.ReportSource = reportDocument;
    }
    else
    {
        reportDocument.PrintToPrinter(1, true, 1, 1);
        sNo++;

    }

}

(這是在黑暗中拍攝的照片,我會寫評論,但不允許這樣做。)

您是否嘗試過在報告中取消設置打印機? 在“頁面設置”對話框中選中“沒有打印機(針對屏幕顯示進行優化)”。

我曾經遇到過尋找(網絡)打印機的報告的問題,導致啟動/加載時間非常長。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM