Winforms report parameter returns no rows

23 Views Asked by At

I've been struggling with this now for 2 hours, the reportviewer executes but it does not return the correct data. Help will be greatly appreciated.

private void button2_Click(object sender, EventArgs e)
{
    this.reportViewer1.LocalReport.DataSources.Clear();
    this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1","PTRDataSet1.xsc"));
    this.reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
    this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";

    ReportParameter p = new ReportParameter("CustCode", "'" +  textBox1.Text.ToString() + "'");
    this.reportViewer1.LocalReport.SetParameters(p);

    reportViewer1.RefreshReport();
}

And this is the stored procedure:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Proc1]
    @CustCode varchar(15)
AS
BEGIN
    SET NOCOUNT ON;

    SELECT * 
    FROM xxx..Shipment
    WHERE CustomerCode = @CustCode;
END

The result is just this:

enter image description here

0

There are 0 best solutions below