Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用带有列表的对象的ReportViewer_C#_.net_Reportviewer - Fatal编程技术网

C# 使用带有列表的对象的ReportViewer

C# 使用带有列表的对象的ReportViewer,c#,.net,reportviewer,C#,.net,Reportviewer,我正在尝试使用这些类创建报告 class purchases { public string purchaser { get; set; } public List<date> dates { get; set; } public decimal totalCost { get; set; } } class date { public List<item> items { get; set; } public decimal co

我正在尝试使用这些类创建报告

class purchases
{
    public string purchaser { get; set; }
    public List<date> dates { get; set; }
    public decimal totalCost { get; set; }
}
class date
{
    public List<item> items { get; set; }
    public decimal costForDate { get; set; }
    public DateTime theDate { get; set; }
}
class item
{
    public int itemID { get; set; }
    public string name { get; set; }
    public decimal cost { get; set; }
}
我遇到的主要问题是告诉rdlc我想要使用一个特定的对象。使用报告向导时,我可以选择purchase类,但列表是单独的数据集。但是,这将不允许我选择要使用的特定购买对象

如果我直接从数据库抓取,我就可以使用报表查看器。问题是我需要在显示之前操作一些字段

(header)
Purchases by purchases.purchaser

(report)
date.theDate
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
-------------------------------
                        date.costForDate

date .theDate
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
-------------------------------
                            date.costForDate

date.theDate
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
    item.itemID      item.name      item.cost
-------------------------------
                            date.costForDate

-----------------------------------------------------------
Total Cost:                     purchases.totalCost