private void ReportViewer1_Load(object sender, EventArgs e) { if (!_isReportViewer1Loaded) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DataSet1 dataset = new DataSet1(); dataset.BeginInit(); reportDataSource1.Name = "DataSet1"; //Name of the report dataset in our .RDLC file reportDataSource1.Value = dataset.DataTable2; this._reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this._reportViewer1.LocalReport.ReportEmbeddedResource = "PorjectDepartmentIT.Report2.rdlc"; dataset.EndInit(); //fill data into adventureWorksDataSet DataSet1TableAdapters.DataTable2TableAdapter DataTable2 = new DataSet1TableAdapters.DataTable2TableAdapter(); DataTable2.ClearBeforeFill = true; DataTable2.Fill(dataset.DataTable2); _reportViewer1.RefreshReport(); _isReportViewer1Loaded = true; } }
private void Frm_ThongKe_Load(object sender, EventArgs e) { //1 reset report this.rpv_BaoCao.Reset(); //2 format report rpv_BaoCao.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.Normal); rpv_BaoCao.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; rpv_BaoCao.ZoomPercent = 100; //config DataSet1 dataset = new DataSet1(); dataset.BeginInit(); this.rpv_BaoCao.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dataset.Tables["DtHoaDon"])); this.rpv_BaoCao.LocalReport.ReportPath = "../../rptReportHoaDon.rdlc"; this.rpv_BaoCao.Location = new System.Drawing.Point(0, 0); dataset.EndInit(); DataSet1TableAdapters.DtHoaDonTableAdapter DTHoaDon = new DataSet1TableAdapters.DtHoaDonTableAdapter(); DTHoaDon.Connection.ConnectionString = HDon_PTA.sChuoiKetNoi(); DTHoaDon.ClearBeforeFill = true; if (sDk != "") DTHoaDon.FillBy(dataset.DtHoaDon, sDk); else DTHoaDon.Fill(dataset.DtHoaDon); this.rpv_BaoCao.RefreshReport(); }
private void Frm_InThongKe_Load(object sender, EventArgs e) { this.reportViewer1.RefreshReport(); this.reportViewer1.RefreshReport(); reportViewer1.Reset(); reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.Normal); reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; reportViewer1.ZoomPercent = 100; DataSet1 dataset = new DataSet1(); dataset.BeginInit(); this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dataset.Tables["dtKho"])); this.reportViewer1.Location = new System.Drawing.Point(0, 0); this.reportViewer1.LocalReport.ReportPath = "../../In.rdlc"; dataset.EndInit(); string connect = "Data Source=DESKTOP-E8DMDAE\\SQLEXPRESS;Initial Catalog=ThuVienSo;Integrated Security=true"; DataSet1TableAdapters.dtKhoTableAdapter takho = new DataSet1TableAdapters.dtKhoTableAdapter(); takho.Connection.ConnectionString = connect; takho.ClearBeforeFill = true; takho.Fill(dataset.dtKho); this.reportViewer1.RefreshReport(); }
private void Frm_ThongKe_Load(object sender, EventArgs e) { //1 reset report this.rpv_BaoCao.Reset(); //2 format report rpv_BaoCao.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.Normal); rpv_BaoCao.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; rpv_BaoCao.ZoomPercent = 100; //config DataSet1 dataset = new DataSet1(); dataset.BeginInit(); this.rpv_BaoCao.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dataset.Tables["DtHoaDon"])); this.rpv_BaoCao.LocalReport.ReportPath = "../../rptReportHoaDon.rdlc"; this.rpv_BaoCao.Location = new System.Drawing.Point(0, 0); dataset.EndInit(); DataSet1TableAdapters.DtHoaDonTableAdapter DTHoaDon = new DataSet1TableAdapters.DtHoaDonTableAdapter(); DTHoaDon.Connection.ConnectionString = HDon_PTA.sChuoiKetNoi(); DTHoaDon.ClearBeforeFill = true; if (sDk != "") { DTHoaDon.FillBy(dataset.DtHoaDon, sDk); } else { DTHoaDon.Fill(dataset.DtHoaDon); } this.rpv_BaoCao.RefreshReport(); }