您的位置:首页 > 其它

winform 中如何将查询出的数据(DataSet或DataTable)显示在reportViewer?

2017-01-15 19:02 411 查看
winform 中如何将查询出的数据(DataSet或DataTable)显示在reportViewer?

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();

================================

this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables[0]));
reportViewer1.RefreshReport();

============================
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐