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();
}
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
toWindows 10 (x64)
without modifications. HereRuntime 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.