Crystal Reports for VS2010 in Windows 7 Pro - Load report failed
Everything is OK in win7 Ultimate x32, but I cannot use the same code with CR for VS2010 in win7 pro x64.
My code: ReportDocument doc = null;
try
{
doc = new ReportDocument();
doc.Load("D:\\CrystalReport4.rpt");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
if (doc != null)
{
doc.Close();
doc.Dispose();
}
}
Always throw exception:
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException: The system cannot find the path specified.
at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
--- End of inner exception stack trace ---
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 CrystalReportsApplication1.Form1.button1_Click(Object sender, EventArgs e) in J:\Projects\CrystalReportsApplication1\CrystalReportsApplication1\Form1.cs:line 33
The path to rpt file is correct. I don't know why inner exception show: The system cannot find the path specified.
My machine install:
- SAP Crystal Reports, version for Visual Studio 2010 - SAP Crystal Reports, runtime engine for .Net Framework 4 开发者_如何学运维(64bit) All of them are SP1, version in GAC: 13.0.2000.0 Anyone can help me fix this issue? ThanksYou may want to try installing the 32 Bit version on the 64 Bit computer. I don't know if the error was the same but I had a similar problem with running some reports that were written by a third party. Installing the 32 bit runtime version fixed it for me.
精彩评论