private void LoadDataReport() { //Create the local report LocalReport report = new LocalReport(); report.ReportEmbeddedResource = "RDLCDemo.ReportTest.rdlc"; //Create the dataset _northWindDataSet = new NorthwindDataSet(); _dataAdapter = new NorthwindDataSetTableAdapters.ProductsByCategoriesTableAdapter(); _northWindDataSet.DataSetName = "NorthwindDataSet"; _northWindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; _dataAdapter.ClearBeforeFill = true; //Created datasource and binding source ReportDataSource dataSource = new ReportDataSource(); System.Windows.Forms.BindingSource source = new System.Windows.Forms.BindingSource(); dataSource.Name = "ProductsDataSources"; //the datasource name in the RDLC report dataSource.Value = source; source.DataMember = "ProductsByCategories"; source.DataSource = _northWindDataSet; report.DataSources.Add(dataSource); //Fill Data in the dataset _dataAdapter.Fill(_northWindDataSet.ProductsByCategories); //Create the printer/export rdlc printer RDLCPrinter rdlcPrinter = new RDLCPrinter(report); rdlcPrinter.BeforeRefresh += rdlcPrinter_BeforeRefresh; //Load in report viewer ReportViewer.Report = rdlcPrinter; }
private void LoadDataReport() { //Create the local report LocalReport report = new LocalReport(); report.ReportEmbeddedResource = "RDLCDemo.ReportTest.rdlc"; //Create the dataset this._northWindDataSet = new NorthwindDataSet(); this._dataAdapter = new NorthwindDataSetTableAdapters.ProductsByCategoriesTableAdapter(); this._northWindDataSet.DataSetName = "NorthwindDataSet"; this._northWindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; this._dataAdapter.ClearBeforeFill = true; //Created datasource and binding source ReportDataSource dataSource = new ReportDataSource(); System.Windows.Forms.BindingSource source = new System.Windows.Forms.BindingSource(); dataSource.Name = "ProductsDataSources"; //the datasource name in the RDLC report dataSource.Value = source; source.DataMember = "ProductsByCategories"; source.DataSource = this._northWindDataSet; report.DataSources.Add(dataSource); //Fill Data in the dataset this._dataAdapter.Fill(this._northWindDataSet.ProductsByCategories); //Create the printer/export rdlc printer RDLCPrinter rdlcPrinter = new RDLCPrinter(report); rdlcPrinter.BeforeRefresh += rdlcPrinter_BeforeRefresh; //Load in report viewer ReportViewer.Report = rdlcPrinter; }