Using data from C# code to create Stimulsoft report

2k Views Asked by At

I have a MVC project and I want to create a report using Stimulsoft Ultimate. I've seen samples that use a direct connection and execute a query to get data from the database. But I have a list of objects in my c# code that I want to use for the report. Is that possible? how?

UPDATE: This is what I have done so far:

    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);
    }

but in the last line (return ...) I get the following error.

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

There are 1 best solutions below

3
On

You should add next section to the web.config file:

  <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>