簡體   English   中英

Crystal Report中的加載報告失敗

[英]Load report failed in Crystal Report

我試圖在Windows窗體應用程序中將水晶報表導出為pdf。我的Crystal Report從Mysql Database獲取數據。這是我的相同代碼..

        ReportDocument doc = new ReportDocument();
        doc.Load("CrystalReport1.rpt");
        doc.SetDataSource(dttable);

        SaveFileDialog saveas = new SaveFileDialog();
        saveas.Filter = "*.pdf|(PDF File)";
        if (saveas.ShowDialog() == DialogResult.OK)
        {

            doc.ExportToDisk(ExportFormatType.PortableDocFormat, saveas.FileName + ".pdf");
            MessageBox.Show("Report Exported !");

        }

在運行上面的代碼。 我收到了錯誤

“加載報告失敗”在doc.Load("CrystalReport1.rpt");

請幫我解決這個問題。

我認為錯誤似乎是您報告的路徑。

我們試試這個:

doc.Load(AppDomain.CurrentDomain.BaseDirectory + "CrystalReport1.rpt");

try
{
    ReportDocument rpt = new ReportDocument();
    rpt.Load(@"D:<path>\Graduation System\Graduation System\graduatedstudents.rpt");
    CRV1.ReportSource = rpt;
    CRV1.Refresh();
}
catch (Exception ex)
{
    throw;
}

我面臨負載報告錯誤

暫無
暫無

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

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