Reporting Services:具有父子孙的业务对象数据源
如何使用 POCO/自定义业务对象创建具有父子孙关系的报表?
public class Invoice
{
public List<Account> Accounts { get; set; }
}
public class Account
{
public List<LineItem> LineItems { get; set; }
}
public void GenerateReport()
{
var localReport = new LocalReport();
localReport.LoadReportDefinition(GetEmbeddedResource("Invoice.rdlc"));
localReport.DataSources.Add(new ReportDataSource("InvoiceDataset", new List<Invoice> { invoices }));
}
最好在子报表上使用表和列表控件。具有本地处理功能的 Reporting Services v10(.rdlc 文件)。
How do I create a report with a parent-child-grandchild relationship using POCOs / custom business objects?
public class Invoice
{
public List<Account> Accounts { get; set; }
}
public class Account
{
public List<LineItem> LineItems { get; set; }
}
public void GenerateReport()
{
var localReport = new LocalReport();
localReport.LoadReportDefinition(GetEmbeddedResource("Invoice.rdlc"));
localReport.DataSources.Add(new ReportDataSource("InvoiceDataset", new List<Invoice> { invoices }));
}
Preferably using Table and List controls over Subreports. Reporting Services v10 with Local Processing (.rdlc files).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Invoice.rdlc
Account.rdlc
添加一个指向 LineItem.rdlc 的子报表,其中包含两个参数:InvoiceId 和 AccountId LineItem.rdlc
要将此报表生成为 pdf:
Invoice.rdlc
Account.rdlc
LineItem.rdlc
To generate this report as a pdf: