首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何设置CrystalDecisions.Enterprise.Desktop.Report的提供者?

如何设置CrystalDecisions.Enterprise.Desktop.Report的提供者?
EN

Stack Overflow用户
提问于 2018-08-08 22:13:13
回答 1查看 171关注 0票数 0

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

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

代码语言:javascript
复制
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

但是,用于脱机的等效代码似乎不会公开"Provider“属性。等价的对象大致如下:

CrystalDecisions.Enterprise.Desktop.Report.ReportLogons.Item(tableIndex),但那里的属性似乎都不是Provider。

有人能帮上忙吗?

EN

回答 1

Stack Overflow用户

发布于 2018-08-10 07:14:59

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

你也许可以这样做

代码语言:javascript
复制
    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可确保所有被引用的表或存储过程都与登录凭据中指定的数据库相关联。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51748883

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档