gpt4 book ai didi

c# - Crystal Report注册表项权限错误,在C#中使用Crystal Report Viewer

转载 作者:行者123 更新时间:2023-11-30 12:56:15 26 4
gpt4 key购买 nike

在 C# Windows 窗体项目中,我使用“CrystalReportViewer”控件来查看“.rpt”文件。它工作正常并正确加载 rpt 文件。但是……

不幸的是,在其他系统中,遇到这个错误的是exe文件:

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

因此无法显示rpt文件!

其他系统有什么问题????

我的项目是在 Visual Studio 2015 中创建的。在其他系统中,我运行并安装了 x86 和 x64 CRRuntime(18 及更早版本)所有系统都安装了 Crystal 报表10和11版本,并且注册正确。

我测试了这个:通过在“.NET Framework 4”和“4.5”上设置“目标框架”来编译 exe。不幸的是,它有同样的错误......

在我所有的测试中,rpt文件都在exe的当前路径下。

请帮帮我!谢谢

//***** 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();
}

最佳答案

这可能是遗留 Crystal Reports 的 Crystal Runtime 安装程序不能很好地与现代 Windows 操作系统兼容的问题,因为 Crystal Report 已卖给 SAP,现在被新的报告基础设施(如 BI 等)所取代。

我在将 VB6 Crytal Reports 迁移到 Windows 10 (x64) 时解决了此类问题,无需修改。这里的 Runtime Installers 不是为 VB6 制作的。在我看来,逆向工程并从工作节点的 crytal 库生成安装程序,并使用它在任何系统上安装您的代码。还要确保选中项目设置中的 Register for COM Interop 选项。有时它也有帮助。

关于c# - Crystal Report注册表项权限错误,在C#中使用Crystal Report Viewer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42172857/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com