我通过一个方法返回一个实体对象作为reportViewer的数据源。但是在  new ReportDataSource("SHOP_Model_printorder ", Proder);的时候出现“/”应用程序中的服务器错误。值不在预期的范围内。, 快点帮帮我啊
             printorder Proder= get_printdate(28);//通过ID返回实体对象
            //DataSet ds = GetDataSet();//GetDataSet()方法可能会得到空值
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(". ") + "\\report2.rdlc ";//RPStatEC.rdlc为要展现的报表
            ReportViewer1.LocalReport.DataSources.Clear();
          
            ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("SHOP_Model_printorder ", Proder));
        

解决方案 »

  1.   

     this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/") + "\\report2.rdlc ";试试
      

  2.   

    Proder是什么类型?
    ReportDataSource构造函数的第二个参数有一定要求的。Value may be an instance of System.Data.DataTable, a System.Collections.IEnumerable value (for example, System.Data.DataView or System.Array), a System.Windows.Forms.BindingSource (for the Microsoft Windows Form control) or a System.Web.UI.IDataSource (for the ASP.NET server control).If this value is an instance of System.Collections.IEnumerable, all elements in the collection must be of the same type, and names of the public properties of the element (as retrieved by the System.ComponentModel.TypeDescriptor.GetProperties() method) must match the field names of the corresponding report data source.Value may also be an instance of System.Type. In this case, an instance of the supplied type is automatically created and added to an automatically created collection. If the type of Value is not any of the aforementioned types, it is added to an automatically created collection. 
      

  3.   


    你的类是从哪里继承的?
    要求是必须从这些类继承,或者实现接口 System.Data.DataTable, a System.Collections.IEnumerable value (for example, System.Data.DataView or System.Array), a System.Windows.Forms.BindingSource (for the Microsoft Windows Form control) or a System.Web.UI.IDataSource (for the ASP.NET server control).
      

  4.   

    不对,我没仔细看最后一句
    If the type of Value is not any of the aforementioned types, it is added to an automatically created collection. 好像会自动创建一个Collection.