0

For our reporting environment, we allow users to run reports "online" (the code for this is based on CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument) or "offline" which is to schedule them on the Business Objects server directly. This code is based on CrystalDecisions.Enterprise.Desktop.Report.

For the online report, we're able to programmatically set the provider with this code:

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

However, the equivalent code for offline doesn't seem to expose the "Provider" property. The equivalent object is roughly this:

CrystalDecisions.Enterprise.Desktop.Report.ReportLogons.Item(tableIndex) but none of the properties there seem to be the Provider.

Anyone able to help?

1 Answers1

0

The closest corresponding ReportLogon property to the LoginInfo Provider property is the ServerType property. However, I don't think you need this in order to set the database credentials.

You can probably do something like this

    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;
       }
    }

Looping through the TableLocationPrefixes ensures that all referenced tables or sprocs are associated to the database specified in the logon credentials.

Scratch
  • 16
  • The inability to set the Provider is ultimately the big roadblock for us. The change in provider was motivated by a requirement for us to disable TLS 1.0/1.1 in our environment - the new provider is basically a requirement to be compatible with TLS 1.2. We can ultimately just manually set the provider for eaach report and republish them but we have hundreds of reports :( – Scott Fortier Aug 10 '18 at 14:30