在报告中的相应主 Table 记录之后添加详细信息 Table 中的记录

Add records from Details Table after respective Master Table record in Report

我有两个帐单表,一个 Bill_Master 另一个是 Bill_Detail。两个表的记录如下...

**BILL_MASTER**
id    party    bill_amount
1      abc      500
2      def      600

**BILL_DETAILS**
mstr_id    sr_no    perticular    amount
 1          1        lunch box     100
 1          2        water bag     400
 2          1        pencil boxes  300
 2          2        a4 papers     100
 2          3        staple pins   200

现在我想按照下面的方式制作一个 RDLC

**RESULT_TABLE**
mstr_id    party      billamount
 1         abc           500
           lunch box     100
           water bag     400
 2         def           600
           pencil boxes  300
           a4 papers     100
           staple pins   200

我的数据库是SQLite。怎么做?

首先执行 Sql Join 以从 DataSet 中的两个表中获取结果。创建一个报告 (EmptyReport) 右键单击​​报告并编辑。在 <DataSets> 标签内添加此部分。

<DataSet Name="DataSet1">
  <Fields>
    <Field Name="mstr_id">
      <DataField>mstr_id</DataField>
      <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="party">
      <DataField>party</DataField>
      <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="billamount">
      <DataField>billamount</DataField>
      <rd:TypeName>System.Int32</rd:TypeName>
    </Field>


然后像这样将该数据源提供给 Rdlc 报告:

reportViewer1.LocalReport.ReportPath = ("testReport.rdlc");
reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[0]));
reportViewer1.RefreshReport();

在您完成上述操作后的报告中。拖放列表中的列。并设置 GroupBy mstr_id.

还有什么事请告诉我。