on 11-24-2014 4:47 PM
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 = new ReportDocument(); 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=-2146232832 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 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.COMException HResult=-2147467259 Message=The system cannot find the path specified. Source=Analysis Server ErrorCode=-2147467259 StackTrace: at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() InnerException:
Solutions i have tried are:
But all in vein. Can somebody please tell me as what's going behind the scene?
Hello,
Please check the reference threads:
Crystal Reports: &quot;Load report failed&quot; error.
Thanks,
DJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Sir for your great concern. But sorry to tell you that solution you posted is not working. Please tell me as what's going wrong with it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shahid,
Hmmm. To run a report, the engine does a few things:
Opens the report.
Logs into the database
Set parameters if they exist.
Queries database and does first pass over the database.
Groups and summarizes and evaluates running totals.
Performs second pass over database, processes formulas,
Runs the report.
These are the major steps that go to running a report. The Load error is very generic so it would be nice to try and break down your code to see where it may be failing.
We know the path is correct. Is the report logging into the database?
Are you passing anything back to the report? Setting parameters, formulas, sorting?
Thanks,
Brian
Sample apps are here:
Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki
Dev help files:
SAP Crystal Reports .NET SDK Developer Guide
SAP Crystal Reports .NET API Guide
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
SAP Crystal Reports, Developer Version for Visual Studio .NET, SP 12 supports VS 2013 fully. If you search this forum, you'll find out that there are a lot of people using this combination with success...
Perhaps, you want to collect your thoughts and ask what you actually want to ask, rather than giving us drips and drabs to hang our self on(?). E.g.;
Problem description
The exact version of CR and VS used
How do we reproduce the problem
OS
Database
Database connection type
- Ludek
VS version = 2013
CR version = 13.0.11.1467 (Is this version right?)
OS = Windows 7 Ultimate (32 bit) with SP1
Database = MS Access 2010
Databse connection type = OLEDB
.NET Framework version = 4.0
Please guide me as what version of CR should i be using for this type of configuration? As i have read that the version i am using is obsolete. I have deleted existing version of CR now. And want a fresh start. Please guide me. Thanks alot. And kindly tell me that corresponding CR runtime is included in the CR developers version of Microsoft .net package?
Hi Shahid,
In the Load you are prefixing your path with @ with <path>. This makes the path a literal string and not a implied path. Remove the @ and it should work.
Just to see what C# is doing, put that path with the @ into a string variable and add a watch to it. Instead of an valid path, you'll still see your literal.
Hope this helps,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.