RDLC report wpf C#

本文关键字:wpf report RDLC | 更新日期: 2023-09-27 18:20:38

我正在用C#编写RDLC报告。我有以下数据库架构。

Contact Class:
String name; int mobile_id
Mobile Class:
string number
Bank Class:
string bank number;
string bank names

一个联系人可以有多个手机号码和多个银行号码。

我想显示报告上的记录,以便显示每个联系人的姓名、手机号码和银行详细信息。我怎么能拿到这个?

RDLC report wpf C#

你是在暗示这份报告只针对一个人吗。。。不适合多人??(主要出于安全目的,打印这样一份包含所有客户/账户所有数据的报告将是一件坏事

如果报告是基于单个人的,那么您应该能够创建一个数据集,根据各自的条件将每个数据集查询到各自返回的数据表中,并在报告中包含所有3个数据表。然后,只需在报告中为每个相应的数据源设置多个Tablix(数据网格)。。。

DataTable tblCustomerInfo = YourQueryToGetCustomerData( customerID );
DataTable tblContactNumbers = YourQueryToGetContacts( customerID );
DataTable tblBankAcnts = YourQueryToGetContacts( customerID );
tblCustomerInfo.TableName = "CustInfo";
tblContactNumbers.TableName = "Contacts";
tblBankAcnts.TableName = "BankAcnts";
DataSet dsAllTables = new DataSet();
dsAllTables.Add( tblCustomerInfo );
dsAllTables.Add( tblContactNumbers );
dsAllTables.Add( BankAcnts );

// Then, you can write out the XSD for the report for named references to the table/columns
dsAllTables.WriteXmlSchema( "YourReport.xsd");
dsAllTables.WriteXml( "YourReport.xml");

然后,编辑您的报告,添加对该架构的引用,该架构将包含您预期在报告中使用的所有数据,并根据需要进行布局。