日期:2014-05-17  浏览次数:20522 次

RDLC报表动态绑定数据
public static DataSet GetValue()
  {
  Dictionary<string, DailyKpiCalculationPercentage> dailyKpi = new Dictionary<string, DailyKpiCalculationPercentage>();
  for (int i = 1; i <= 5; i++)
  {
  if (i < 3)
  {
  DailyKpiCalculationPercentage dailyKpi1 = new DailyKpiCalculationPercentage(i, 1);
  dailyKpi.Add(i.ToString(), dailyKpi1);
  }
  else
  {
  DailyKpiCalculationPercentage dailyKpi1 = new DailyKpiCalculationPercentage(i, 0);
  dailyKpi.Add(i.ToString(), dailyKpi1);
  }
   
  }
  DataSet ds = new DataSet();
  ds.Tables.Add(Rison.Reflection.ClassConvert.ToDataTable(dailyKpi, "DailKpiCalculationPercentage"));
  return ds;
  }
我这样生成一个dataset,怎么才能把dataset中的数据绑定到rdlc报表中额,求大神帮忙,急急急急急急急

------解决方案--------------------
绑定dataset到rdlc中
ReportDataSource rds=new ReportDataSource("DataSet1",dtSource);//dtSource为你的dataset
ReportViewer1.LocalReport.ReportPath="";
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();