public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { BaoCaoTienCongTheoHoiDong rpt = new BaoCaoTienCongTheoHoiDong(); rpt.Site = this.Site; return(rpt); }
private void btnBaoCao_Click_1(object sender, EventArgs e) { try { using (SqlConnection cnn = new SqlConnection(constr)) { using (SqlCommand cmd = cnn.CreateCommand()) { cnn.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_baoCaoTienCongTheoHoiDong"; cmd.Parameters.AddWithValue("@id", (cbbHoiDong.SelectedValue)); // cmd.Parameters.AddWithValue("@ngayKetThuc", DateTime.Parse(txtNgayKetThuc.Text)); SqlDataAdapter dap = new SqlDataAdapter(cmd); DataTable data = new DataTable(); dap.Fill(data); BaoCaoTienCongTheoHoiDong report = new BaoCaoTienCongTheoHoiDong(); report.SetDataSource(data); crystalReportViewer1.ReportSource = report; } } } catch (Exception exx) { Debug.WriteLine(exx.Message); } }