public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { BaoCaoTopDiem rpt = new BaoCaoTopDiem(); rpt.Site = this.Site; return(rpt); }
public void crystalReportViewer1_Load(object sender, EventArgs e) { DataTable tbl; string cnnstr = ConfigurationManager.ConnectionStrings["test"].ConnectionString; using (SqlConnection cnn = new SqlConnection(cnnstr)) { cnn.Open(); using (SqlCommand cmd = new SqlCommand("topsinhvien_diem1", cnn)) { cmd.CommandType = CommandType.StoredProcedure; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { tbl = new DataTable(); da.Fill(tbl); } } cnn.Close(); } // MessageBox.Show("Bạn có muốn thoát khỏi chương trình không ?", "Xác nhận", MessageBoxButtons.OK); BaoCaoTopDiem report = new BaoCaoTopDiem(); report.SetDataSource(tbl); crystalReportViewer1.ReportSource = report; }