如何获得“行”?在ReportDataSource里面? [英] How can I get the "Row" inside ReportDataSource?
问题描述
我有以下代码:
ReportDataSource [] _reportDataSources = new ReportDataSource [1];
_reportDataSources [0] = GetDeviceHistoryData(unitheaderid);
如何在其中获得行?当我在调试期间鼠标悬停在_reportDataSources [0]上时,我可以获得Value,而在Value中我有Row。我希望获得行计数。
如果count为0,那么我将完成我的逻辑。
我已尝试过以下但行无法出现:
if(_reportDataSources [0] .Value .....){}
之后值,然后它不会显示Row供我选择。
Hi, I have the following codes:
ReportDataSource[] _reportDataSources = new ReportDataSource[1];
_reportDataSources[0] = GetDeviceHistoryData(unitheaderid);
How can I get the "Row" inside of it? When I mouse over the _reportDataSources[0] during debug, I can get "Value" and inside "Value" I have "Row". I want to get the "Row" count.
If count is 0, then I will do my logic.
I have tried below but the "Row" cannot coming out:
if(_reportDataSources[0].Value.....){}
After Value, then it will not show Row for me to select.
推荐答案
经过一番研究,我得出了以下解决方案:
Hi, after some research, I have come out with the following solution:
DataTable dtDeviceHistory = new DataTable();
dtDeviceHistory = (DataTable)_reportDataSources[0].Value;
if (!dtDeviceHistory.IsNullOrEmpty())
{
if (dtDeviceHistory.Rows.Count > 0)
{
DisplayReport(_reportDataSources, _unitDto);
}
}
希望得到一些反馈。谢谢。
Hope to get some feedback. Thank you.
这篇关于如何获得“行”?在ReportDataSource里面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!