我有一个数据表,我从一个SQL适配器填充。我能够在datagridview中成功显示它,但是当我尝试做一个reportviewer时,它无法正常工作。
DataTable dt = new DataTable();
dt.TableName = "SwipeReport";
da.Fill(dt);
reportViewer1.Reset();
reportViewer1.ProcessingMode = ProcessingMode.Local;
reportViewer1.LocalReport.ReportEmbeddedResource = "POC1.SwipeReport.rdlc";
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("SwipeReport", dt));
reportViewer1.RefreshReport();
我不相信我正确设置了报告嵌入资源,因为我没有指定"报告" 应该填写reportviewer窗口。我是否正确实现了这一点?
答案 0 :(得分:0)
希望这有帮助
// create a new report from the created CrystalReport
GeneralSupportRpt myDataReport = new GeneralSupportRpt();
// set the data source of the report
myDataReport.SetDataSource(dataTable);
// set the report source of the created “crystalReportViewer”
// component to the created report
ReportViewer.ReportSource = myDataReport;