我想用LINQ来填充水晶报告.
这是我的代码:
var results = (from supp in dbdata.Suppliers select supp).ToList();
cr1.Load(@"CrystalReport1.rpt");
cr1.SetDataSource(results);
crystalReportViewer1.ReportSource = cr1;
当我运行应用程序时,它会生成一个错误:
DataSet does not support System.Nullable<>.
我该如何解决?
最佳答案 试试这个 :
CrystalReport1 cr = new CrystalReport1();
var results = (from supp in dbdata.tSamples
where supp.ID == IDNUMBER
select new { supp.Name, supp.Model, supp.Producer }).ToList();
cr.SetDataSource(results);
crystalReportsViewer1.ReportSource = cr;