C # how to populate a crystal report using LINQ

I am trying to populate a crystal report using LINQ.

Here is my code:

var results = (from supp in dbdata.Suppliers select supp).ToList(); cr1.Load(@"CrystalReport1.rpt"); cr1.SetDataSource(results); crystalReportViewer1.ReportSource = cr1; 

When I launch the application, it generates an error:

DataSet does not support System.Nullable <>.

How to fix it?

+4
source share
1 answer

Try the following:

  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; 
+2
source

Source: https://habr.com/ru/post/1443183/


All Articles