注册 | 登录 | 设为首页 | 加入收藏
您当前的位置:飞翔学院-IT中国 → 编程开发Asp → 文章内容

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

作者:IT 来源:不详 发布时间:2007-9-1 23:15:31
在《简单实现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上。


http://www.itcnw.com/
  • 打印文档
  • 推荐好友
  • 返回顶部
  • 增大字体
  • 减少字体
关于本站 | 工作机会 | 合作网站 | 广告服务 | 市场合作| 联系我们 | 抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved