我得到的错误是"尚未为数据源提供数据源实例' AssetLatencyCompleteDataSet_fsAssetLatencyComplete'"
我有2个数据源,AssetSummaryDataSet和AssetLatencyCompleteDataSet
我只能选择1个数据实例,我环顾四周,似乎我应该可以为单个报告添加其他数据源,并且它们将填充在此处显示的报告查看器控件中。
我创建了DrillThrough处理程序,但是我仍然遇到上述错误。
如何将缺少的数据源实例添加到报告查看器中?
{
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();
}
}
}
答案 0 :(得分:1)
您只需要更改以下行
localReport.DataSources.Add(new ReportDataSource("fsAssetLatencyComplete", (object)assetLatencyCompleteDataSet.fsAssetLatencyComplete));
而不是" fsAssetLatencyComplete"指定" AssetLatencyCompleteDataSet_fsAssetLatencyComplete"