日期:2014-05-18  浏览次数:20842 次

C# Winform ReportView手动绑定数据之后在报表中不显示
我是使用报表向导新建的报表,把DataSet里的数据直接拖到行,列和值。不知道这个有没有关系的?
下面是手动绑定的代码
 DataSet DataSet1 = new DataSet();
  string select = "select * from Shippment_profits";
  DataSet1 = bc.GetDataSet(select, "Shippment_profits");

  ReportDataSource rds = new ReportDataSource("Shippment_profits", DataSet1.Tables["Shippment_profits"]);
  reportViewer1.LocalReport.DataSources.Clear();
  reportViewer1.LocalReport.DataSources.Add(rds);
  this.reportViewer1.Refresh();
是不是漏了什么所以才显示不出来的?,还是漏了什么步骤?
有调试了,DataSet里面有数据的。谢谢!!!

下面这一句是系统自动生成的,用这一句就能看到数据。可是我现在要手动绑定,不要调用系统的
//TODO: 这行代码将数据加载到表“UNIONSKYDataSet.Shippment_profits”中。您可以根据需要移动或删除它。
  this.Shippment_profitsTableAdapter.Fill(this.UNIONSKYDataSet.Shippment_profits);
this.reportViewer1.Refresh();

------解决方案--------------------
this.reportViewer1.RefreshReport(); this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);