private void ReportViewer2_Load(object sender, EventArgs e) // Отчет Order с фильтром { if (!_isReportViewer2Loaded) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DataSetOrder dataset = new DataSetOrder(); dataset.BeginInit(); reportDataSource1.Name = "DataSet1"; // Name of the report dataset in our .RDLC file reportDataSource1.Value = dataset.Order; // Название таблицы в .xsd файле (DataSet) this._reportViewer2.LocalReport.DataSources.Add(reportDataSource1); this._reportViewer2.LocalReport.ReportEmbeddedResource = "PorjectDepartmentIT.Report3.rdlc"; dataset.EndInit(); //fill data into adventureWorksDataSet DataSetOrderTableAdapters.OrderTableAdapter Order = new DataSetOrderTableAdapters.OrderTableAdapter(); Order.ClearBeforeFill = true; Order.Fill(dataset.Order, "Готов", "Не готов"); _reportViewer2.RefreshReport(); _isReportViewer2Loaded = true; } }
private void btn_dataPick_Click(object sender, RoutedEventArgs e) { string trigger = txt_triggerStatus.Text; //if (!_isReportViewer2Loaded) //{ Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DataSetOrder dataset = new DataSetOrder(); dataset.BeginInit(); reportDataSource1.Name = "DataSet1"; // Name of the report dataset in our .RDLC file reportDataSource1.Value = dataset.Order; // Название таблицы в .xsd файле (DataSet) ReportViewer _reportViewer2 = new ReportViewer(); _reportViewer2.LocalReport.DataSources.Add(reportDataSource1); _reportViewer2.LocalReport.ReportEmbeddedResource = "PorjectDepartmentIT.Report3.rdlc"; //this._reportViewer2.LocalReport.DataSources.Add(reportDataSource1); //this._reportViewer2.LocalReport.ReportEmbeddedResource = "PorjectDepartmentIT.Report3.rdlc"; dataset.EndInit(); //fill data into adventureWorksDataSet DataSetOrderTableAdapters.OrderTableAdapter Order = new DataSetOrderTableAdapters.OrderTableAdapter(); Order.ClearBeforeFill = true; Order.Fill(dataset.Order, null, trigger); _reportViewer2.Refresh(); //_reportViewer2 = _reportViewer3; //_reportViewer2.RefreshReport(); _isReportViewer2Loaded = true; }