我已设置以下代码将一些数据加载到水晶报表中。
private void FrmReportViewer_Load(object sender, EventArgs e)
{
DataSet1.dtStudent4ReportDataTable dt = new DataSet1.dtStudent4ReportDataTable();
DataSet1TableAdapters.dtStudent4ReportTableAdapter rta = new DataSet1TableAdapters.dtStudent4ReportTableAdapter();
dt = rta.GetData(100001);
ReportDocument rDoc = new ReportDocument();
rDoc.Load(@"D:\SE\MS\Windows_apps\Projects\SMSV1-CURRENT\SMSV1\REPORTS\CRStudentEnrolment.rpt");
rDoc.SetDataSource(dt);
crv.ReportSource = rDoc;
}
当我检查dt变量中的值时,它会显示一条应该是的记录!但rDoc.SetDataSource(dt)
在编译时抛出错误
错误1以下方法或之间的调用不明确 特性: 'CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(System.Collections.IEnumerable)' 和 'CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(System.Data.DataTable)'D:\ SE \ MS \ Windows_apps \ Projects \ SMSV1-CURRENT \ SMSV1 \ FrmReportViewer.cs 30 13 SMSV1
here is a youtube video on what happens
为什么会这样?我该如何解决这个问题?