【问题标题】:crystal reports: how to fetch multiple rows on parameter passed to crystal report水晶报表:如何获取传递给水晶报表的参数的多行
【发布时间】:2012-06-18 22:18:05
【问题描述】:

我有一张表 tbl_invoice。我想在这个表中显示数据的水晶报告。对于每张发票,我都有 invoiceid(主键)和账单编号。每张发票的主键都会更改,但 billno 保持不变。我正在获取 max invoiceid 的 billno 并将其传递给水晶报告。但它只显示了水晶报表中的最后一条记录。如何显示与账单号匹配的所有记录? 我写了这段代码

private void button1_Click(object sender, EventArgs e)
    {
        SalesInvoice_Caret crt = new SalesInvoice_Caret();
        crt.SetParameterValue("BillNo", txtBillNo.Text);
        crystalReportViewer1.ReportSource = crt;
        crystalReportViewer1.Refresh();
    }

    private void crt_sales_invoice_viewer_Load(object sender, EventArgs e)
    {
        string getBill = "Select top 1 BillNo from tbl_sales_invoice order by SalesInvoiceId desc";
        SqlCommand cmd = new SqlCommand(getBill, con);
        con.Open();
            object obj = cmd.ExecuteScalar();
        con.Close();

        MessageBox.Show(obj.ToString());
        txtBillNo.Text = obj.ToString();


    }

【问题讨论】:

    标签: c# crystal-reports


    【解决方案1】:

    我认为您需要在创建“SalesInvoice_Caret”对象时传递所有发票编号和所需数据。创建一个查询,为所选账单编号提供所有 invoiceid 编号。并将数据传递给报告。在报告中,您需要使用组专家为每个 invoiceid-billno 对创建一个特定的报告。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多