我原来的代码实现了绑定List<EmployeeDM>,我现在要实现动态绑定List<EmployeeDM>或List<ClientDM>,请问该怎样实现?public void ShowInfo(List<EmployeeDM> list, string ReportName)
{
    this.reportViewer1.LocalReport.DataSources.Clear();
    ReportDataSource pds = new ReportDataSource("DataSetEmployee",list);
    this.reportViewer1.LocalReport.DataSources.Clear();
    this.reportViewer1.LocalReport.DataSources.Add(pds);
    this.reportViewer1.LocalReport.ReportEmbeddedResource = ReportName;
    this.reportViewer1.RefreshReport();
}private void Frm报表预览_Load(object sender, EventArgs e)
{
    this.reportViewer1.RefreshReport();
}List<EmployeeDM> list = 员工BLL.GetAllEmployee();
Frm报表预览 baobiao = new Frm报表预览();
baobiao.ShowInfo(list, "UI.基础信息.员工.rdlc");
baobiao.Show();c#报表绑定

解决方案 »

  1.   

    public void ShowInfo(List<EmployeeDM> list, string ReportName)
    {
            //指定报表路径
            ReportViewer1.LocalReport.ReportPath = MapPath("Report1.rdlc");    
            //设置数据源
            ReportDataSource rds = new ReportDataSource("DataSetEmployee", list);
            ReportViewer1.LocalReport.DataSources.Add(rds);
            ReportViewer1.LocalReport.Refresh();
    }
     
      

  2.   

    http://blog.csdn.net/happy09li/article/details/6931959把泛型转换成DataTable再绑定