winform 中如何将查询出的数据(DataSet或DataTable)显示在reportViewer?我按以下方法做的,无任何效果,也不报错:
1、加了Report1.rdlc,reportViewer1数据源选择好了Report1.rdlc
2、代码:
BindingSource BindingSource1 = new BindingSource();BindingSource1.DataSource = DataSet1;//DataSet1在前面已加载,无误ReportDataSource ReportDataSource1 = new ReportDataSource();ReportDataSource1.Value = BindingSource1;this.reportViewer1.LocalReport.DataSources.Add(ReportDataSource1);this.reportViewer1.RefreshReport();