我试图在Windows窗体应用程序中将水晶报告导出为pdf。我的水晶报告正在从Mysql数据库获取数据。这是我的代码相同的…
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");
行'Load report failed'
请帮我解决这个问题
我认为错误似乎是你报告的路径。
让我们试试这个:
doc.Load(AppDomain.CurrentDomain.BaseDirectory + "CrystalReport1.rpt");
骰子游戏
try
{
ReportDocument rpt = new ReportDocument();
rpt.Load(@"D:<path>Graduation SystemGraduation Systemgraduatedstudents.rpt");
CRV1.ReportSource = rpt;
CRV1.Refresh();
}
catch (Exception ex)
{
throw;
}
I am facing load report error