[英]Microsoft Report Viewer Drillthrough using Multiple Data Sources
The error I'm getting is "A data source instance has not been supplied for the data source 'AssetLatencyCompleteDataSet_fsAssetLatencyComplete'" 我收到的错误是“尚未为数据源'AssetLatencyCompleteDataSet_fsAssetLatencyComplete提供数据源实例'”
I have 2 Data Sources, AssetSummaryDataSet and AssetLatencyCompleteDataSet 我有2个数据源,AssetSummaryDataSet和AssetLatencyCompleteDataSet
I can only select 1 Data instance, I've looked around and it appears that I should be able to add additional data sources for a single report and they would populate within the report viewer control seen here. 我只能选择1个数据实例,环顾四周,看来我应该能够为单个报表添加其他数据源,并且它们将填充在此处看到的报表查看器控件中。
I have created the DrillThrough handler, however I still get the above error. 我已经创建了DrillThrough处理程序,但是仍然出现上述错误。
How can I add the data source instance I'm missing to the report viewer? 如何将缺少的数据源实例添加到报表查看器?
{
public partial class frmAssetSummaryRpt : Form
{
public frmAssetSummaryRpt()
{
InitializeComponent();
}
private void frmAssetSummaryRpt_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'assetSummaryDataSet.fsAssetRecoverySummaryByClientWO' table. You can move, or remove it, as needed.
this.fsAssetRecoverySummaryByClientWOTableAdapter.Fill(this.assetSummaryDataSet.fsAssetRecoverySummaryByClientWO);
reportViewer1.Drillthrough += new DrillthroughEventHandler(reportDrillthroughEventHandler);
this.reportViewer1.RefreshReport();
}
void reportDrillthroughEventHandler(object sender, DrillthroughEventArgs e)
{
LocalReport localReport = (LocalReport)e.Report;
localReport.DataSources.Add(new ReportDataSource("fsAssetLatencyComplete", (object)assetLatencyCompleteDataSet.fsAssetLatencyComplete));
}
private void button1_Click(object sender, EventArgs e)
{
frmAssetLatencyFullRpt AssetLatencyFullReport = new frmAssetLatencyFullRpt();
AssetLatencyFullReport.Show();
}
}
} }
You need to change only following line 您只需要更改以下行
localReport.DataSources.Add(new ReportDataSource("fsAssetLatencyComplete", (object)assetLatencyCompleteDataSet.fsAssetLatencyComplete));
Instead of "fsAssetLatencyComplete" specify "AssetLatencyCompleteDataSet_fsAssetLatencyComplete" 代替“ fsAssetLatencyComplete”,指定“ AssetLatencyCompleteDataSet_fsAssetLatencyComplete”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.