【问题标题】:How to set the Provider for CrystalDecisions.Enterprise.Desktop.Report?如何设置 CrystalDecisions.Enterprise.Desktop.Report 的 Provider?
【发布时间】:2018-08-08 14:13:12
【问题描述】:

对于我们的报表环境,我们允许用户“在线”运行报表(此代码基于 CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument)或“离线”,即直接在 Business Objects 服务器上安排报表。此代码基于 CrystalDecisions.Enterprise.Desktop.Report。

对于在线报告,我们可以使用以下代码以编程方式设置提供程序:

If crTableNew.ConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE Then
    crLogonInfo = CType(crAttributes("QE_LogonProperties"), PropertyBag)
    crLogonInfo("Data Source") = serverName
    crLogonInfo("Initial Catalog") = databaseName
    crLogonInfo("Provider") = "SQLNCLI11"
End If

但是,offline 的等效代码似乎没有公开“Provider”属性。等价的对象大致是这样的:

CrystalDecisions.Enterprise.Desktop.Report.ReportLogons.Item(tableIndex) 但似乎没有提供者的属性。

有人可以帮忙吗?

【问题讨论】:

    标签: crystal-reports business-objects business-objects-sdk


    【解决方案1】:

    与 LoginInfo Provider 属性最接近的对应 ReportLogon 属性是 ServerType 属性。但是,我认为您不需要它来设置数据库凭据。

    你可能会做这样的事情

        foreach(ReportLogon reportLogon in reportLogons)
        {
           reportLogon.UseOriginalDataSource = false;
    
           reportLogon.CustomServerName = serverName;
           reportLogon.CustomUserName = userId;
           reportLogon.CustomPassword = password;
           reportLogon.CustomDatabaseName = databaseName;
    
           foreach(TablePrefix tablePrefix in reportLogon.TableLocationPrefixes)
           {
              tablePrefix.MappedTablePrefix = databaseName + ".dbo.";
              tablePrefix.UseMappedTablePrefix = true;
           }
        }
    

    循环通过 TableLocationPrefixes 确保所有引用的表或存储过程都与登录凭据中指定的数据库相关联。

    【讨论】:

    • 无法设置 Provider 最终是我们最大的障碍。提供者更改的动机是要求我们在我们的环境中禁用 TLS 1.0/1.1 - 新提供者基本上是与 TLS 1.2 兼容的要求。我们最终可以手动设置每个报告的提供者并重新发布它们,但我们有数百个报告:(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    • 2012-05-02
    • 1970-01-01
    • 1970-01-01
    • 2020-09-18
    • 2021-07-14
    相关资源
    最近更新 更多