小编Moh*_*fia的帖子

将多个对象设置为水晶报表的数据源

我想在我的c#windows应用程序中制作一个水晶报告,关键是我想使用.net对象作为我的报告数据源,我在互联网上找到它的示例代码如下,并使用它们并且它工作正常:

        ArrayList Mainlst = new ArrayList();
        Mainlst.Add(new testOBJ { Firstname = "test1", Lastname = "test11" });
        Mainlst.Add(new testOBJ { Firstname = "test2", Lastname = "test21" });
        Mainlst.Add(new testOBJ { Firstname = "test3", Lastname = "test31" });
        Mainlst.Add(new testOBJ { Firstname = "test4", Lastname = "test41" });
        Mainlst.Add(new testOBJ { Firstname = "test5", Lastname = "test51" });
        testCrystalReport rpt = new testCrystalReport ();
        rpt.SetDataSource(Mainlst);
        crystalReportViewer1.ReportSource = rpt;
Run Code Online (Sandbox Code Playgroud)

但我想为这些重复的信息发送额外的对象,例如学校信息,但我不能发送这个额外的对象,有没有任何解决方案,我可以发送多个对象到水晶报告?当然我知道我可以使用多个数据表和数据集作为水晶报表数据源,但在这里我只想使用对象和IEnumerables作为水晶报表的数据源.

.net c# crystal-reports

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

crystal-reports ×1