|
Hello All
I am creating a Crystal Report with 3 subreports(Active,expired and terminated)
in my CrystalReport Viewer I have these methods
public DataSet GetReportData1()
{
GetQueryStringParameters();
IRadTechsFacade radTechsFacade = FacadeFactory.CreateRadTechsFacade();
DataSet ds = radTechsFacade.RadTechReport(m_firstName,m_lastName,m_ssn);
return ds;
}
public DataSet GetReportData2()
{
GetQueryStringParameters();
IRadTechsFacade radTechsFacade = FacadeFactory.CreateRadTechsFacade();
DataSet ds = radTechsFacade.RadTechReportExpired(m_firstName,m_lastName,m_ssn);
return ds;
}
public DataSet GetReportData3()
{
GetQueryStringParameters();
IRadTechsFacade radTechsFacade = FacadeFactory.CreateRadTechsFacade();
DataSet ds = radTechsFacade.RadTechReportTerminated(m_firstName,m_lastName,m_ssn);
return ds;
}
public ReportDocument GetReportDocument()
{
string repFilePath = Server.MapPath("RadTechPublicReport.rpt");
ReportDocument repDoc = new ReportDocument();
repDoc.Load(repFilePath);
repDoc.Subreports["Active"].SetDataSource(GetReportData1());
repDoc.Subreports["Expired"].SetDataSource(GetReportData2());
repDoc.Subreports["Terminated"].SetDataSource(GetReportData3());
return repDoc;
}
private void Page_Load(object sender, System.EventArgs e)
{
crvRadTechPublicReportViewer.ReportSource = GetReportDocument();
crvRadTechPublicReportViewer.DataBind();
}
Now In my main page where I want my export button(export button is not in crystalviewer.aspx but in another aspx page where there are 3 txtbox a search button along with export button). I have written the button click event as
private void btnReport_Click(object sender, System.EventArgs e)
{
RadTechPublicReportViewer radTechViewer = new RadTechPublicReportViewer();
ReportDocument repDoc = new ReportDocument();
repDoc = radTechViewer.GetReportDocument();
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,true,"RadTechPublicReport");
}
I am getting the following error please can some one tell me what the error is.
The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The system cannot find the file specified.
Source Error:
Line 95: string repFilePath = Server.MapPath("RadTechPublicReport.rpt"); Line 96: ReportDocument repDoc = new ReportDocument(); Line 97: repDoc.Load(repFilePath); Line 98: repDoc.Subreports["Active"].SetDataSource(GetReportData1()); Line 99: repDoc.Subreports["Expired"].SetDataSource(GetReportData2());
Source File: c:\inetpub\wwwroot\orcweb\radtechs\reports\radtechpublicreportviewer.aspx.cs Line: 97
Stack Trace:
[COMException (0x80004005): The system cannot find the file specified. ] CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +72 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +218 [Exception: Load report failed.] CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +857 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) Dhss.Dph.Orc.Web.RadTechs.Reports.RadTechPublicReportViewer.GetReportDocument() in c:\inetpub\wwwroot\orcweb\radtechs\reports\radtechpublicreportviewer.aspx.cs:97 Dhss.Dph.Orc.Web.RadTechs.Default1.btnReport_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\orcweb\radtechs\default.aspx.cs:149 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292
Thanks
Neha
|