1.在前台添加水晶报表显示控件。
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
2.后台添加绑定代码。
protected void Page_Load(object sender, EventArgs e)
{
//创建报表文档
ReportDocument myReport = new ReportDocument();
//取到报表文件物理路径
string reportPath = Server.MapPath("CrystalReport1.rpt");
myReport.Load(reportPath);
//将创建的新的报表文档绑定
this.CrystalReportViewer1.ReportSource = myReport;
this.CrystalReportViewer1.DataBind();
}