c# - The System cannot find the path specified for some crystal reports -


i using crystal reports latest edition in mvc application. 1 report working fine weird error occurring continuously in loading other reports. have used switch statement. report in first case running fine. in other cases there error:

an exception of type 'system.runtime.interopservices.comexception' occurred in myapp.dll not handled in user code additional information: the system cannot find path specified.

public actionresult seereport(formcollection f) {     reportdocument rd = new reportdocument();      string s = f["rptname"];     switch (s)     {         case ("011501"):         {             dataset ds = new dataset();              commonprocs_ahpi.commonprocess xrptprocess = new commonprocs_ahpi.commonprocess();             ds.extendedproperties["index"] = 1150101;//13502 013501_3             datatable xdtr = new datatable();             xdtr.tablename = "_rptitle_";              xdtr.columns.add("n100", system.type.gettype("system.double"));             xdtr.columns.add("s100", system.type.gettype("system.string"));             xdtr.columns.add("s101", system.type.gettype("system.string"));             xdtr.columns.add("s102", system.type.gettype("system.string"));             xdtr.columns.add("s1", system.type.gettype("system.string"));             xdtr.columns.add("s2", system.type.gettype("system.string"));             xdtr.columns.add("s3", system.type.gettype("system.string"));             xdtr.columns.add("s4", system.type.gettype("system.string"));             xdtr.columns.add("s5", system.type.gettype("system.string"));             xdtr.columns.add("s6", system.type.gettype("system.string"));             ds.tables.add(xdtr);              datatable xdt = new datatable();             xdt.tablename = "rpdata";             xdt.columns.add("s102", system.type.gettype("system.string"));             xdt.columns.add("s107", system.type.gettype("system.string"));             xdt.columns.add("s20", system.type.gettype("system.string"));             xdt.columns.add("s21", system.type.gettype("system.string"));             xdt.columns.add("s22", system.type.gettype("system.string"));             xdt.columns.add("s23", system.type.gettype("system.string"));             xdt.columns.add("s24", system.type.gettype("system.string"));             xdt.columns.add("s25", system.type.gettype("system.string"));              datarow xrow = xdt.newrow();              xrow["s102"] = "1";             xrow["s21"] = "4";             xrow["s22"] = f["begin_code"];             xrow["s23"] = f["end_code"];             xrow["s24"] = "n";             xrow["s25"] = "";             xdt.rows.add(xrow);             ds.tables.add(xdt);             xdt.acceptchanges();              ds = xrptprocess.processcall(ds);              rd.load(path.combine(server.mappath("~/rptgl_ahpi/"), "011501.rpt"));             rd.setdatasource(ds);             response.buffer = false;             response.clearcontent();             response.clearheaders();              break;         }         case ("013501_3"):         {             dataset ds = new dataset();              commonprocs_ahpi.commonprocess xrptprocess = new commonprocs_ahpi.commonprocess();             ds.extendedproperties["index"] = 13502;             datatable xdtr = new datatable();             xdtr.tablename = "_rptitle_";              xdtr.columns.add("n100", system.type.gettype("system.double"));             xdtr.columns.add("s100", system.type.gettype("system.string"));             xdtr.columns.add("s101", system.type.gettype("system.string"));             xdtr.columns.add("s102", system.type.gettype("system.string"));             xdtr.columns.add("s1", system.type.gettype("system.string"));             xdtr.columns.add("s2", system.type.gettype("system.string"));             xdtr.columns.add("s3", system.type.gettype("system.string"));             xdtr.columns.add("s4", system.type.gettype("system.string"));             xdtr.columns.add("s5", system.type.gettype("system.string"));             xdtr.columns.add("s6", system.type.gettype("system.string"));             ds.tables.add(xdtr);              datatable xdt = new datatable();             xdt.tablename = "rpdata";             xdt.columns.add("s102", system.type.gettype("system.string"));             xdt.columns.add("s107", system.type.gettype("system.string"));             xdt.columns.add("s20", system.type.gettype("system.string"));             xdt.columns.add("s21", system.type.gettype("system.string"));             xdt.columns.add("s22", system.type.gettype("system.string"));             xdt.columns.add("s23", system.type.gettype("system.string"));             xdt.columns.add("s24", system.type.gettype("system.string"));             xdt.columns.add("s25", system.type.gettype("system.string"));             xdt.columns.add("d1", system.type.gettype("system.datetime"));             xdt.columns.add("d2", system.type.gettype("system.datetime"));              datarow xrow = xdt.newrow();              xrow["s102"] = "1";             //xrow["s21"] = "4";             xrow["s21"] = f["begin_code"];             xrow["s22"] = f["end_code"];             xrow["s23"] = "1";             xrow["s24"] = "0";             xrow["s25"] = "";             xrow["d1"]  = convert.todatetime(f["begin_date"]);             xrow["d2"]  = convert.todatetime(f["end_date"]);             xdt.rows.add(xrow);             ds.tables.add(xdt);             xdt.acceptchanges();              ds = xrptprocess.processcall(ds);              rd.load(path.combine(server.mappath("~/report/"), "013501_3.rpt"));             rd.setdatasource(ds);             rd.refresh();             response.buffer = false;             response.clearcontent();             response.clearheaders();              break;          }       }      try     {         stream stream = rd.exporttostream(crystaldecisions.shared.exportformattype.portabledocformat);         stream.seek(0, seekorigin.begin);         return file(stream, "application/pdf", "report.pdf");     }     catch (exception ex)     {         throw;     } } 

the first case works fine , reports downloaded other reports generate error mentioned above.

i got it... report erroneous. error "system cannot find path specified" misleading. actually, when report goes stream looks report data since corrupt didn't specified report , throws exception of path not found. solved making wpf application inside app , viewed report there , got real error report.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -