datasource - 如何使用 Active Reports 13 rdlx 报告动态设置子报告的数据源
问题描述
我有一个使用 rdlx 格式定义的 Active Reports 13 报告。该报告还包含一些子报告。
在报表设计器中定义时,数据源设置为一些测试数据,但是,当报表嵌入 WPF 应用程序时,我们希望实用地更新数据库的位置。
我们已经能够更新主报表的数据源,但是(对我们来说!)不清楚如何更新子报表的数据源。
string report = _reportPath;
// checked the report file exists ...
if (File.Exists(report))
{
// create and setup the data source
// create an empty page report
GrapeCity.ActiveReports.PageReport def = new GrapeCity.ActiveReports.PageReport();
//load the report layout
def.Load(new System.IO.FileInfo(report));
//setup the dataset
GrapeCity.ActiveReports.PageReportModel.DataSource myDataSource = def.Report.DataSources[0];
def.Report.DataSources[0].ConnectionProperties.DataProvider = "OLEDB";
def.Report.DataSources[0].ConnectionProperties.ConnectString = @"RunData.mdb;provider=Microsoft.Jet.OLEDB.4.0;";
// loop through subreports and set the location of the run data database
// ????
reportViewer.LoadDocument(def.Document);
}
有没有人指出我们应该如何在“????”处编写代码 上面还更新子报告?
解决方案
这是在报告文档LocateDataSource上的事件中完成的
此外,请参阅此示例以了解如何使用 LocateDataSource:DataSet DataSource。您可以通过在此处下载 ActiveReports 13 试用版来访问示例应用程序。
最好的,
葡萄城支持团队
推荐阅读
- python - 从列表中删除括号和引号
- mongodb - 使用 Meteor 方法从 MongoDB 下载大量文档
- python - 给多个字典我可以得到每个键的最低(或最高)值吗?
- r - 如何添加具有两个不同轴变量的变量
- r - 具有特定权限的 Knit 和 Rmarkdown
- python - 用于从 SQL 语句中的 from 子句中提取表名的 python 库,
- javascript - 文本到语音 Web api 导致语音设置错误
- python - 为什么 init_timer 函数会冻结我的 tkinter 窗口?
- ansible - 无法使用 ansible playbook 创建目录
- amazon-web-services - 基于 AWS IoT Core MQTT 的文件传输。物理设备可以监听文件吗?