I am trying to export a crystal report to a pdf file that takes in a user-specified start-date and end-date. The report has default values for these parameters, and it exports without issue if I try it using those default values.
However, when i try to specify the parameters, the ExportToStream() function throws the error "the system cannot find path specified".
Code:
string startDateParm = "2018-01-01";
string endDateParm = "2018-01-31";
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports/ReportExample.rpt")));
rd.SetParameterValue("Start Date", startDateParm);
rd.SetParameterValue("End Date", endDateParm);
Response.Buffer = false;
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Figured it out. I am still not sure what the exact issue was, but it had something to do with the default values for the parameters. Steps to solve in VS2013: