Report Viewer remains blank after passing the parameters.

2 posts, 0 answers
  1. Gangatharan
    Gangatharan avatar
    1 posts
    Member since:
    Feb 2019

    Posted 25 Feb Link to this post

    Hi, I am working with the reporting tool and I have created a trdp file using the standalone designer. I am using MySql connection and my sql query have one parameter. When I test the SQL result with the parameters, the report is generated as expected. Now I created a winform and added the report viewer tool to it and have added the trdp file. When I add the parameters and tried to run, the report viewer remains blank. So, I tried to remove the parameter from my sql query in the trdp file and run my winform again, all the selected record is shown in my report viewer. If I use parameter, then it remains blank with no report. What could be the issue. This is how I add my parameter 

            private void ReportViewerForm1_Load(object sender, EventArgs e)
            {
                this.reportViewer1.RefreshReport();
                reportViewer1.ReportSource.Parameters.Add("jsno",myjsid);
            }

    My Sql Query in trdp file.

    Select o.JsNo, b.ConsignmentNo, c.* From js_orderdetails o inner join js_billingdetail b on b.OrderID = o.ID inner join js_labelorders l on l.OrderId = o.ID inner join js_labelcustomers c on c.Id = l.LabelCustomerId where o.JsNo = @jsno

  2. Nasko
    Admin
    Nasko avatar
    1050 posts

    Posted 28 Feb Link to this post

    Hi Gangatharan,

    Adding the parameter names and their values to the ReportViewer.ReportSource.Parameters collection is only part of the story. The same jsno parameter should also be added to the report definition file (TRDP) in the Report.ReportParameters collection. There you can specify the parameter type, name, default value, and other parameter properties. Only then the o.JsNo = @jsno part of your SQL query will receive the myjsid value.

    Regards,
    Nasko
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top