Report viewer with parameters. W#

0

Hello

The report (.rdlc) is successfully returning data with the help of a datatable , however I need to put parameters and it does not work.

Follow the code:

 private void frmReportTeste_Load(object sender, EventArgs e)
    {
        try
        {
            // TODO: This line of code loads data into the 'dsOrcPrevisto.dtOrcPrevisto' table. You can move, or remove it, as needed.
            this.dtOrcPrevistoTableAdapter.Fill(this.dsOrcPrevisto.dtOrcPrevisto);

            ReportParameter p1 = new ReportParameter("op.venda", venda.ToString());
            ReportParameter p2 = new ReportParameter("op.vendedor", vendedor.ToString());
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });

            this.reportViewer1.RefreshReport();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

Displays the error:

  

Message="Attempting to set a 'op.sales' report parameter that is not defined in this report."

As far as I understand, op.venda is not in sql that fills datatable but is yes.

    
asked by anonymous 01.07.2016 / 17:05

0 answers