我无法在 ASP.Net 网页上显示 Crystal 报表。该网站只是一个内部网站,因此您会看到我已将文件路径编码到该网站中。我想我已经很接近让这个工作了,但我显然错过了一些东西。任何人都可以帮忙吗?
他是我的代码:
void BindReport()
{
ReportDocument rd = new ReportDocument();
//Report is saved on an external server which I have full access too
rd.Load(@"\\MyServer\Reports\MyReport.rpt");
rd.SetDatabaseLogon("UserName", "Password", "MyServer", "MyDatabase", true);
//The Report has 2 parameter and links directly to a stored procedure on a SQL Server
rd.SetParameterValue("@uspDateFrom", new DateTime(2012, 05, 01));
rd.SetParameterValue("@uspDateTo", new DateTime(2012, 05, 31));
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
CrystalReportViewer1.RefreshReport();
}
//I call my report on a button click
protected void buttonPreviewReport_Click(object sender, EventArgs e)
{
BindReport();
}
当报告尝试运行时,我会弹出一个对话框,询问我的参数值,即使我已经传递了它们!?即使我在对话框提示中输入它们,我也会收到一条消息,指出没有可用的有效报告源。
有人有什么想法吗?
我正在使用 ASP.Net 4.0
提前致谢