1.ASP.NET中第一步 設計報表文件 即rpt文件
在這個操作之前要先做好數(shù)據(jù)集的設計 即顯示那個表就把那個表的字段都列出來 方面設計報表文件
設計好數(shù)據(jù)集之后
再設計報表文件 把報表文件設計好了
做一下操作就可以了
當然這是個簡單的例子 至于詳細的還要看自己的鉆研了
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);
設置數(shù)據(jù)集
myReport.SetDataSource(ds);
crystalReportViewer1.ReportSource = myReport;
posted on 2011-08-29 14:09
sanmao 閱讀(575)
評論(1) 編輯 收藏