So I'm trying to load an .rpt file to my c# project by setting the datasource as the rpt file. But the problem is I get an error saying;
CrystalDecisions.Shared.CrystalReportsException: 'Load report failed.
Here is the complete error code that is showing
<code> CrystalDecisions.Shared.CrystalReportsException
HResult=0x80131600
Message=Load report failed.
Source=CrystalDecisions.CrystalReports.Engine
StackTrace:
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 payrollsystemLatest.viewcr.button1_Click(Object sender, EventArgs e) in D:\echosystem\1080proll(new)\payrollsystemLatest\viewcr.cs:line 30
at System.Windows.Forms.Control.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.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 payrollsystemLatest.Program.Main() in D:\echosystem\1080proll(new)\payrollsystemLatest\Program.cs:line 21
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
COMException: Unable to load report.
Here is my code to load the rpt file to the viewer
<code> ReportDocument rpt = new ReportDocument(); rpt.Load(@"D:\sample.rpt"); reportviewer.ReportSource = rpt; reportviewer.Refresh()
<p>So far, I have tried;</p> <ul> <li>Double checking my destination where the .rpt file is</li> <li>Deleting everything in the TEMP folder</li> <li>Setting my printjob to -1</li> <li>And reinstalling both 32 and 64 bit runtime</li> </ul> <p>Any ideas how to fix this? Any help are appriciated!</p>