2013-10-27 3 views
9
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); 
    } 

मैं प्रक्रिया संग्रहीत और डिजाइनर में निष्पादित लेकिन मैं यह करने के लिए मानकों को नहीं भेजते हैं और जब रन अनुप्रयोग, मैं निम्नलिखित त्रुटि मिलती है:मैं Stimulsoft को पैरामीटर कैसे भेजूं?

त्रुटि: SqlCommand.Prepare विधि सभी चर लंबाई की आवश्यकता है पैरामीटर को स्पष्ट रूप से सेट गैर-शून्य आकार सेट करने के लिए।

मैं क्या करूँ?

उत्तर

9

मेरे समस्या निम्न कोड के साथ हल किया गया था:

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

     } 
4

आप संकलन रिपोर्ट से पहले निम्नलिखित कोड का उपयोग कर सकते हैं:

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

इसके अलावा, आप मापदंडों अभिव्यक्ति में अतिरिक्त चर का उपयोग कर सकते हैं। इस मामले में आपको रिपोर्ट प्रस्तुत करने से पहले चर के मान को सेट करना चाहिए।

संबंधित मुद्दे