Мне удалось назначить разные отчеты, но когда я запускаю программу, она говорит, что мне нужно назначить источники данных, как мне этого добиться?
РЕДАКТИРОВАТЬ: Вот мой код:
Код: Выделить всё
public Report()
{
InitializeComponent();
this.View_StatoMagTableAdapter.Fill(this.NGStoreV2DataSet.View_StatoMag);
this.mag2TableAdapter.Fill(this.NGStoreV2DataSet.mag2);
this.mag2BindingSource.DataMember = "mag2";
this.mag2BindingSource.DataSource = this.NGStoreV2DataSet;
}
private void reportViewer1_Load(object sender, EventArgs e)
{
this.reportViewer1.Reset();
var binding = new BindingSource();
binding.DataSource = this.NGStoreV2DataSet.mag2;
ReportDataSource rds = new ReportDataSource("NGStoreV2DataSet", binding);
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "ReportViewerForm.Report2.rdlc";
this.reportViewer1.RefreshReport();
}
Я уже пробовал разные комбинации, но ни одна из них не работает.
Комбинации типа:
Код: Выделить всё
var binding = new BindingSource();
binding.DataSource = this.NGStoreV2DataSet.mag2;
ReportDataSource rds = new ReportDataSource("NGStoreV2DataSet", binding);
Код: Выделить всё
ReportDataSource rds = new ReportDataSourc("NGStoreV2DataSet", this.mag2BindingSource);
Спасибо tezzo и Hadi за большую помощь
Подробнее здесь: https://stackoverflow.com/questions/333 ... portviewer
Мобильная версия