当前位置:雨林木风下载站 > 网页设计教程 > 详细页面

《容易完成Crystal Report动态加载》补遗

《容易完成Crystal Report动态加载》补遗

更新时间:2025-12-24 文章作者:未知 信息来源:网络 阅读次数:

在《简单实现Crystal Report动态加载》中,所提供的方法有时候并不能很好的工作。于是通过不断的实验和资料查询,终于发现了更好的方法。核心代码如下 CrystalDecisions.We...
在《简单实现Crystal Report动态加载》中,所提供的方法有时候并不能很好的工作。于是通过不断的实验和资料查询,终于发现了更好的方法。核心代码如下

CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
String path = Server.MapPath("./");
path = path + @"\Report\Report.rpt";
path = path.Replace("\\","\\\\");
ReportDocument Rep=new ReportDocument();
Rep.Load(path);
DataSet ds = getDataSet(getConn());
Rep.SetDataSource(ds);
CrystalReportViewer1.ReportSource = Rep;
CrystalReportViewer1.DataBind();

如上代码所示,这个方法通过ReportDocument类的Load()方法把报表模板加载入内存,利用推模式把DataSet数据推入模板。最后把这个ReportDocument绑定到CrystalReportViewer上。

温馨提示:喜欢本站的话,请收藏一下本站!

本类教程下载

系统下载排行