I am developing a simple Windows form app using Crystal Report (Version 13.0) and .NET Framework 4.0 as well as VS 2013. What i am doing is that i have a Crystal report viewer on the form which is supposed to show/load my report when button is clicked. My code to load a report is:
ReportDocument rpt =newReportDocument(); rpt.Load(@"e:\<path>\CrystalReport1.rpt"); crystalReportViewer1.ReportSource= rpt; crystalReportViewer1.Refresh();
Problem i am getting is that whenever i click button, an exception occurs saying this:
CrystalDecisions.Shared.CrystalReportsException was unhandled HResult=-2146232832Message=Load report failed.Source=CrystalDecisions.CrystalReports.EngineStackTrace: at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename,OpenReportMethod openMethod,Int16 parentJob) at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) at CystalReportsApp.Form1.button1_Click(Object sender,EventArgs e)in e:\<path>\CystalReportsApp\Form1.cs:line 32 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m,MouseButtons button,Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID,Int32 reason,Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at CystalReportsApp.Program.Main()in e:\<path>\CystalReportsApp\Program.cs:line 19 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state) at System.Threading.ThreadHelper.ThreadStart()InnerException:System.Runtime.InteropServices.COMExceptionHResult=-2147467259Message=The system cannot find the path specified.Source=AnalysisServerErrorCode=-2147467259StackTrace: at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&DocumentPath,Int32Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object&DocumentPath,Int32Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()InnerException:
Solutions i have tried are:
- Checked the path again and again.
- Checking file permissions on the temp folder as well as on the folder where my report resides.
But all in vein. Can somebody please tell me as what's going behind the scene?