1.ASP.NET中第一步 设计报表文件 即rpt文件
在这个操作之前要先做好数据集的设计 即显示那个表就把那个表的字段都列出来 方面设计报表文件
设计好数据集之后 
再设计报表文件 把报表文件设计好了 
做一下操作就可以了
当然这是个简单的例子 至于详细的还要看自己的钻研了  
cmd.Connection = cn;
            cmd.CommandText = "SELECT EmployeeId1 as EmployeeId,EmployeeName1 as EmployeeName From Employee1";
            da.SelectCommand = cmd;
            da.Fill(ds, "Employee");
           // this.dataGridView1.DataSource = ds.Tables["Employee"].DefaultView;


            //使用报表对象加载报表
            ReportDocument myReport = new ReportDocument();
            string reportPath = Application.StartupPath + "/cp1.rpt";// Server.MapPath("~/app_data/crystalreport1.rpt");
            myReport.Load(reportPath);
设置数据集
            myReport.SetDataSource(ds);
            crystalReportViewer1.ReportSource = myReport;

posted on 2011-08-29 14:09 sanmao 阅读(561) 评论(1)  编辑  收藏

FeedBack:
# re: 水晶报表的显示报表数据[未登录]
2016-04-20 14:39 | 123
123456  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜