0

System.ArgumentNullException

结果

    public ActionResult Index()
    {
        return View();
    }

    MyDataSet ds = new MyDataSet();
    public ActionResult PersonReportView()
    {
        ReportViewer reportViewer = new ReportViewer();
        reportViewer.LocalReport.DataSources.Clear();
        reportViewer.ProcessingMode = ProcessingMode.Local;
        reportViewer.SizeToReportContent = true;
        reportViewer.Width = Unit.Percentage(900);
        reportViewer.Height = Unit.Percentage(900);
        var connectionString = ConfigurationManager.ConnectionStrings["MVCtestDBConnectionString"].ConnectionString;
        SqlConnection conx = new SqlConnection(connectionString);
        SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM Person", conx);
        adp.Fill(ds, ds.Person.TableName);
        reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\Report1.rdlc";
        reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[0]));            
        ViewBag.ReportViewer = reportViewer;
        return View();
    }

我安装了 reportviewerformvc14.140.1000.523.nupkg 和 microsoft.aspnet.mvc.5.2.3.nupkg Rdlc 路径是正确的。

4

0 回答 0