Report trong MS Chọn DataSet 11... Report trong MS: Đưa control để hiển thị dữ liệu vào Report: 14... Report trong MS: Chọn DataSet cho control 15... Report trong MS: Đưa các trường
Trang 1TRƯỜNG ĐẠI HỌC NHA TRANG
CHỦ ĐỀ 5 BÁO BIỂU LẬP TRÌNH CƠ SỞ DỮ LIỆU VỚI C#
1
Trang 5Report đơn:
5
Trang 6Report nhóm:
- Dữ liệu bảng Sanpham:
6
Trang 7Report nhóm:
7
Trang 8Report có tham số:
8
Trang 10Report trong MS
R_Click → Add → New Item, chọn nhóm Reporting → Report
Add New DataSource
10
Trang 11Report trong MS
Chọn DataSet
11
Trang 12Report trong MS
Chọn Data Connection:
12
Trang 13Report trong MS
Chọn Database Objects:
13
Trang 14Report trong MS:
Đưa control để hiển thị dữ liệu vào Report:
14
Trang 15Report trong MS:
Chọn DataSet cho control
15
Trang 16Report trong MS:
Đưa các trường cần hiển thị, các control cần thiết vào Report
16
Trang 17Report trong MS
Đưa các trường cần hiển thị, các control cần thiết vào Report
Có thể định dạng dữ liệu khi hiển thị
Gom nhóm khi hiển thị
17
Trang 18Report trong MS:
Tạo Form mới, thêm ReportViewer vào Form
Gán thuộc tính ReportSource là Report vừa tạo ở trên
18
Trang 20Crystal Report:
- Cài đặt thêm CRfor_13_0
- Các bước tạo CR:
R_Click → Add → New Item, chọn nhóm Reporting → Crystal Reports
Using the Report Wizard
20
Trang 21Crystal Report:
Create New Connection, chọn OLE DB (ADO)
Chọn MS OLE DB Provider for SQL Server
21
Trang 23Crystal Report:
Chọn nguồn dữ liệu:
23
Trang 24Crystal Report
Chọn các trường hiển thị
Chọn trường gom nhóm
Chọn kiểu trình bày Report
Hoàn thành Report mặc định ở chế độ Design (cho phép chỉnh sửa)
Click Main Report Review để xem trước kết quả
24
Trang 25Crystal Report:
- Đưa CR lên Form:
Tạo 1 Form mới
Thêm control CrystalReportViewer vào Form
Gán thuộc tính ReportSource là Report tạo ở trên
25
Trang 26Tham số trong Crystal Report:
- Thiết kế CR lấy nguồn dữ liệu từ Stored Procedure (có tham số)
- Đưa CR lên Form:
Tạo 1 Form mới
Thêm control CrystalReportViewer vào Form
Không gán thuộc tính ReportSource.
26
Trang 27Xử lý sự kiện tham số trong Crystal Report:
ReportDocument rept = new ReportDocument ();
rept.Load( " / /rptDSSV_Khoa.rpt" );
rept.SetParameterValue( "@MaKhoa" , textBox1.Text);
crystalReportViewer1.ReportSource = rept;
27
Trang 28Lưu ý, thiết lập cấu hình để in CR:
TableLogOnInfo tb = new TableLogOnInfo ();