-->

using Microsoft.Reporting.WinForms; using System; using System.Data; using System.Windows.Forms; namespace EnterpriseReporting public partial class ReportForm : Form public ReportForm() InitializeComponent(); private void ReportForm_Load(object sender, EventArgs e) // 1. Set processing mode to Local reportViewer1.ProcessingMode = ProcessingMode.Local; // 2. Specify the path to the RDLC file reportViewer1.LocalReport.ReportPath = @"Reports\SalesReport.rdlc"; // 3. Fetch your application data DataTable salesData = FetchSalesData(); // 4. Create and add the ReportDataSource (Name must match the RDLC dataset name) ReportDataSource rds = new ReportDataSource("SalesDataSet", salesData); reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); // 5. Refresh the report canvas reportViewer1.RefreshReport(); private DataTable FetchSalesData() DataTable dt = new DataTable(); dt.Columns.Add("Product", typeof(string)); dt.Columns.Add("Amount", typeof(decimal)); dt.Rows.Add("Cloud Subscription", 12500.00); dt.Rows.Add("On-Premise License", 8400.00); return dt; Use code with caution. Troubleshooting Common Production Issues

The following example demonstrates how to programmatically set a data source for a parameterized RDLC report in a C# WinForms application :