《简单实现Crystal Report动态加载》补遗

王朝asp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

在《简单实现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上。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航