且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果代码为空,请检查我的 s-s-rS 报告

更新时间:2023-11-28 10:33:04

数据集是报表内部的.对于给定的报告参数,没有外部 API 来查找特定数据集返回的记录数.

DataSets are internal to a report. There is no external API to find the number of records returned by a particular dataset for a given report parameters.

您可以采用两种方法来解决问题:

There are two approaches you can take to solve the problem:

1.使用 LocalReport

在 C# 代码中创建您的数据集,检查它是否有行,然后将其作为数据源提供给 s-s-rS.

Create your DataSet in C# code, check if it has rows, and then give this as a DataSource to s-s-rS.

ReportDataSource ds = new ReportDataSource(dsName, data);
ReportGenerator gen = new ReportGenerator(data, dsName);
reportViewer.Reset();
reportViewer.LocalReport.DataSources.Add(ds);
reportViewer.LocalReport.DisplayName = displayName;
reportViewer.LocalReport.LoadReportDefinition(gen.GeneraReport());

参考:使用 Reporting Services 的动态报告

2.以 CSV 格式下载您的报告.这将为您提供一组参数的每个数据源的原始数据.在这里可以查看返回的行数.

2 . Download your report as a CSV. This will give you the raw data for each DataSource for your set of parameters. Here you can check the number of rows returned.