1.ASP.NET中第一步 設(shè)計(jì)報(bào)表文件 即rpt文件
在這個(gè)操作之前要先做好數(shù)據(jù)集的設(shè)計(jì) 即顯示那個(gè)表就把那個(gè)表的字段都列出來(lái) 方面設(shè)計(jì)報(bào)表文件
設(shè)計(jì)好數(shù)據(jù)集之后
再設(shè)計(jì)報(bào)表文件 把報(bào)表文件設(shè)計(jì)好了
做一下操作就可以了
當(dāng)然這是個(gè)簡(jiǎn)單的例子 至于詳細(xì)的還要看自己的鉆研了
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;
//使用報(bào)表對(duì)象加載報(bào)表
ReportDocument myReport = new ReportDocument();
string reportPath = Application.StartupPath + "/cp1.rpt";// Server.MapPath("~/app_data/crystalreport1.rpt");
myReport.Load(reportPath);
設(shè)置數(shù)據(jù)集
myReport.SetDataSource(ds);
crystalReportViewer1.ReportSource = myReport;
posted on 2011-08-29 14:09
sanmao 閱讀(576)
評(píng)論(1) 編輯 收藏