4

In a C# Windows form project, I used "CrystalReportViewer" control to view ".rpt" files. It works correctly and loads rpt files correctly. But...

Unfortunately, in other systems, it's exe file encountered with this error:

Ether the Crystal Reports registry key permissions are insufficient ... 

Therefore the rpt files can't be shown!

What is the problem in other systems????

My project is created in Visual Studio 2015. And in other systems, I run and installed the x86 and x64 CRRuntime (version 18, and older) the versions 10 and 11 of crystal report are installed in all systems, and they registered correctly.

I tested this: compiling exe by setting the "Target Framework" on ".NET Framework 4" and "4.5". Unfortunately, it has same error...

In all my tests, the rpt files there are in the current path of exe.

Please Help Me! thank you

//***** This is my testing code:

private void crystalReportViewer1_Load(object sender, EventArgs e)
{
    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load(strRptPath);
    cryRpt.DataSourceConnections[0].SetConnection("MyServer", "DBName", false);
    cryRpt.DataSourceConnections[0].IntegratedSecurity = true;

    cryRpt.SetParameterValue("CenterName", strCenterName);
    cryRpt.RecordSelectionFormula = "{Table.Field} = 'value'";

    crystalReportViewer1.ReportSource = cryRpt;
    crystalReportViewer1.Refresh();
}
Tetsuya Yamamoto
  • 24,297
  • 8
  • 39
  • 61
nabegheh95
  • 195
  • 3
  • 19
  • add some code showing how are you using crystal report. – Shashi Bhushan Feb 11 '17 at 06:31
  • I edited my question and input my code. thank you for your answer @Shashi bhushan – nabegheh95 Feb 11 '17 at 06:40
  • I don't see any issue in code, It must be issue with compilation for target platform. As i remember, if we try to compile with x64 bit then crystal reports complains but on x86 configuration works fine. So can you try to compile with x86 and see. – Shashi Bhushan Feb 11 '17 at 06:54
  • Yes, I compile with x86, Unfortunately it has same error. It's strange!!! – nabegheh95 Feb 11 '17 at 07:05
  • I worked with Crystal Report and it was working good with x86. Just want to confirm, you have installed correct binaries on machine. I hope you already checked but just cross check. – Shashi Bhushan Feb 11 '17 at 07:48
  • although not exactly the same, something similar is discussed in this post http://stackoverflow.com/questions/8903210/crystal-report-redistributable-for-windows-server-2008-an-error-has-occurred/8989531#8989531 – jambonick Feb 20 '17 at 11:05
  • AFAIK you can set to compile EXE into `Any CPU` configuration - but ensure that all installed runtime libraries are version matched with OS platform (x86/x64) and compiled references (see https://wiki.scn.sap.com/wiki/pages/viewpage.action?original_fqdn=wiki.sdn.sap.com&pageId=56787567 for details). – Tetsuya Yamamoto Feb 23 '17 at 01:09

2 Answers2

0

This could be an issue that Crystal Runtime installer for legacy crystal reports not playing well with modern windows operating system as crystal report is sold out to SAP and now superseded by new reporting infrastructure like BI etc.

I've tackled such issue in migrating VB6 Crytal Reports to Windows 10 (x64) without modifications. Here Runtime Installers are not made for VB6. In my opinion reverse engineer and generate installer from crytal libraries of working node and use it to install on any system w.r.t your code. Also make sure to check Register for COM Interop option in project settings. At times it also helps.

SACn
  • 1,862
  • 1
  • 14
  • 29
0

Have you checked the regedit permissions for the CR for the user?

Set the user permissions for the selected folder to "Full Access".

For Crystal Reports XI:

  • HKEY_LOCAL_MACHINE\Software\Wow6432Node\Business Objects\Suite 11.0\ (on 64 bit OS)
  • HKEY_LOCAL_MACHINE\Software\Business Objects\Suite 11.0\ (on 32 bit OS)
  • HKEY_CURRENT_USER\Software\Business Objects\Suite 11.0\

For Crystal Reports 10:

  • HKEY_LOCAL_MACHINE\Software\Crystal Decisions\10.0\
  • HKEY_CURRENT_USER\Software\Crystal Decisions\10.0\
Igor Dimchevski
  • 412
  • 3
  • 13