文档彩票走势图>>Stimulsoft Reports.WinForms教程-2019>>Stimulsoft Reports.WinForms教程:在报表中使用LINQ查询
Stimulsoft Reports.WinForms教程:在报表中使用LINQ查询
立即点击下载Stimulsoft Reports.Ultimate最新版
本示例说明了如何在报表数据中使用Linq查询。Linq语法允许您在使用数据源时使用最少的代码执行复杂的筛选、排序和分组操作。为此,您可以使用用于处理业务对象的方法:
public Form1() { InitializeComponent(); Item[] items = new Item[] { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Jim Bob"}, new Book{Id = 2, Price = 8.50, Genre = "Drama", Author = "John Fox"}, new Movie{Id = 1, Price = 22.99, Genre = "Comedy", Director = "Phil Funk"}, new Movie{Id = 1, Price = 13.40, Genre = "Action", Director = "Eddie Jones"}}; var query1 = from i in items where i.Price > 9.99 orderby i.Price select i; report.Load("..\\Report.mrt"); report.RegBusinessObject("MyData", "MyData", query1); }
在下面的屏幕截图中,您可以看到示例代码的结果。