Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send parameters to Stimulsoft?

    public virtual ActionResult GetReportSnapshot()
    {
       var data = (ComparativeBalanceReportDS) TempData["ComparativeSession"];


        StiReport report = new StiReport();
        report.Load(Server.MapPath("~/Content/StimulReports/SampleReport.mrt"));

        report.Compile();

        report["fromDocumentNumber"] = "1";
        report["toDocumentNumber"] = "85";
        return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
   }

I have stored procedure and execute in designer but I do not send parameters to it and when run App, I get the following error:

Error:SqlCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.

What do I do?

like image 644
roozbeh Avatar asked Oct 27 '13 07:10

roozbeh


1 Answers

My problem was solved with the following code :

       public virtual ActionResult GetReportSnapshot()
        {
         var data = (ComparativeBalanceReportDS) TempData["ComparativeSession"];       
          StiReport report = new StiReport();
         report.Dictionary.DataStore.Clear();
         report.Load(Server.MapPath("~/Content/StimulReports/SampleReport.mrt"));
         report["@enterpriseId"] = data.EnterpriseId;
         report["@toDocumentNumber"] = data.NumberFilter.FromDocumentDocumentNumber;
         report["@fromDocumentNumber"] = data.NumberFilter.ToDocumentDocumentNumber;
         report["@fromDate"] = data.DateFilter.FromDocumentDate.Value;
         report["@toDate"] = data.DateFilter.ToDocumentDate.Value;
         return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);

        }
like image 116
roozbeh Avatar answered Sep 27 '22 19:09

roozbeh