VS 2017 是否允许 rdlc 报告使用两个数据集? [英] Does VS 2017 allow two datasets for an rdlc report?

查看:50
本文介绍了VS 2017 是否允许 rdlc 报告使用两个数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个框架,用于保存从应用程序打印的报告.我有一份报告,我正在尝试向其中添加第二个数据集,但我不断收到错误消息尚未为数据源‘DataSetTwo’提供数据源实例".是否无法向报告中添加第二个数据集?

I have a framework for my applications that hold reports that are printed from the application. I have one report that I'm trying to add a second dataset to but I keep getting the error "A data source instance has not been supplied for the data source 'DataSetTwo'". Is it impossible to add a second dataset to a report?

我添加第二个数据源的原因是我有一个数据源几乎可以填充报告中的所有信息,然后第二个数据源将用于报告中的 tablix.我无法使用第一个数据集,因为由于某种原因 group by 无法处理 SQL 语句,所以我将添加一个字段较少的新数据集,因此 group by 不是问题.

The reason I'm adding a second data source is I have one that will populate nearly all information on the report and then the second is going to be used for a tablix in the report. I can't use the first dataset because for some reason the group by is not working on the SQL statement so I'm going to add a new dataset with less fields so the group by isn't a problem.

推荐答案

错误

尚未为数据源DataSetTwo"提供数据源实例

A data source instance has not been supplied for the data source 'DataSetTwo'

表明您没有提供数据源.

indicate you had not supply the data source.

当您生成报告时,您是否提供了第二个数据集?

When you generate the report, did you supply the second dataset?

它应该看起来像这样:

ReportViewer.LocalReport.DataSources.Clear();
ReportDataSource rd1 = new ReportDataSource("DataSetOne", dataset1);
ReportDataSource rd2 = new ReportDataSource("DataSetTwo", dataset2);
ReportViewer.LocalReport.DataSources.Add(rd1);
ReportViewer.LocalReport.DataSources.Add(rd2);
ReportViewer.LocalReport.Refresh();

这篇关于VS 2017 是否允许 rdlc 报告使用两个数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆