Question

    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?

Was it helpful?

Solution

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

        }

OTHER TIPS

You can use the following code before compile report:

report.Dictionary.DataSources["DataSourceName"].Parameters["ParameterName"].Value = ""

Also you can use the additional variables in the parameters expression. In this case you should set the variable's value before render report.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top