简体   繁体   English

水晶报表MVC4中的加载报表失败?

[英]Load report failed in Crystal report MVC4?

Hi i generate Crystal Report for my MVC4 project. 嗨,我为我的MVC4项目生成了Crystal Report。 if i select the FromDate and ToDate depend upon the dates the report have to generate. 如果我选择FromDate和ToDate取决于报表必须生成的日期。

While loading report it showing one error near to rc.Load(). 加载报告时,它在rc.Load()附近显示一个错误。 That error is mention below. 该错误在下面提到。

An exception of type 'CrystalDecisions.Shared.CrystalReportsException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code CrystalDecisions.CrystalReports.Engine.dll中发生了类型'CrystalDecisions.Shared.CrystalReportsException'的异常,但未在用户代码中处理

My Controller Code 我的控制器代码

 public ActionResult VisitSummaryReport()

    {
        return View();
    }

    [HttpPost]

     public ActionResult GetDates(VisitorsViewModel VisitorsVM)
    {
        var fromdt = Convert.ToDateTime(VisitorsVM.FromDate);
        var todt = Convert.ToDateTime(VisitorsVM.ToDate);
        SqlConnection con = new SqlConnection(@"Data Source=192.168.0.73\SQLEXPRESS,14330;Initial Catalog=WafeERP_NEW;User ID=sa;Password=wafewin;");
        DataTable dt = new DataTable();
        try
        {
            con.Open();
            SqlCommand cmd = new SqlCommand("Select * from View_VisitorsForm where  VisitingDate >='" + fromdt  +"'and VisitingDate <= '" + todt  +"'", con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            adp.Fill(dt);

        }
        catch (Exception ex)
        {

            throw;
        }
        ReportClass rc = new ReportClass();
        rc.FileName = Server.MapPath("/Sales/Reports/rpt_VisitSummaryCrystalReport.rpt");
        rc.Load();
        rc.SetDataSource(dt);
        Stream stream = rc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        return File(stream, "application/pdf");
         }

Perhaps adding the following to your web.config file would help: 将以下内容添加到您的web.config文件中可能会有所帮助:

<dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.Web" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.Windows.Forms" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.ClientDoc" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonControls" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonObjectModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.Controllers" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.CubeDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataSetConversion" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.ObjectFactory" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.Prompting" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.ReportDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="CrystalDecisions.ReportAppServer.XmlSerialize" publicKeyToken="692fbea5521e1304" culture="neutral"/>
    <bindingRedirect oldVersion="13.0.3500.0" newVersion="13.0.2000.0"/>
  </dependentAssembly>

Source: CR for VS sp21 breaks Exact CR2013 Runtime - SAP Answer 来源: VS sp21的CR中断了确切的CR2013运行时-SAP Answer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM