This is a migrated thread and some comments may be shown as answers.

Report Viewer remains blank after passing the parameters.

1 Answer 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gangatharan
Top achievements
Rank 1
Gangatharan asked on 26 Feb 2019, 02:58 AM

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

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 28 Feb 2019, 02:50 PM
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
Tags
General Discussions
Asked by
Gangatharan
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or