asp.net mvc-使用C#代码中的数据创建Stimulsoft报告



我有一个MVC项目,我想使用Stimulsoft Ultimate创建一个报告。我看到过使用直接连接并执行查询从数据库中获取数据的示例。但是我的c#代码中有一个对象列表,我想在报告中使用这些对象。这可能吗?怎样

更新:这就是我迄今为止所做的:

    public ActionResult Report()
    {
         string FilePath =  "..\Report.mrt";
         report.Load(Server.MapPath(FilePath));
         report.Compile();
         report["ShamsiCurrDate"] = myGlobalVariables.DateNow;
         var Data = GetDataFromDB();
         report.Render();
         return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
    }

但在最后一行(return…)中,我得到了以下错误。

    System.ArgumentNullException: Value cannot be null.
    Parameter name: value

您应该在web.config文件中添加下一节:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

最新更新