How can I load datatable as ReportDataSource?
问题 I am trying to do something like: this.reportViewer.LocalReport.DataSources.Clear(); DataTable dt = new DataTable(); dt = this.inputValuesTableAdapter.GetData(); Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource(); rprtDTSource = dt; // this line generates exception //this.reportViewer.LocalReport.DataSources.Add(rprtDTSource); this.reportViewer.RefreshReport(); How can I load datatable as ReportDataSource? The current code produces