on 01-29-2023 5:18 AM
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>
What version of CR for VS are you using?
Get SP 33 from here and read all about it:
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
Uninstall both the MSI's, 32 and 64 bit and then
Run the EXE to integrate into VS depending on the version of VS you are using, note there is an EXE for VS 2019 and lower and one for VS 2022 and above.
Installer prompt at the end to install the 32 or 64 MSI, don't manually install them
See my blog for upgrading:
And see if either of my test app's on the WIKI work for you:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.