Reputation: 149
I am trying to display rdlc reports in c# windows aplication.I am passing parameters to the report by this code-named
localReport.SetParameters(new ReportParameter[] { new ReportParameter("JobC", m) });
I have defined this parameter in the report also. But the parameter is not being passed into the report and the database table is not getting filtered. The first record, though, is being displayed., how to solve this error?
Upvotes: 0
Views: 2914
Reputation: 1
1.Go to the rdlc Design view
2.on the report data view (On the left) select parameters
3.Right click Add
4.set the name (best you Check Allow blank and allow null value)click OK
5.add the textfiled value OR select one from your tablix,right click and select Expression
6.set the expression e.g
=Parameters!title.Value7.In your form that contains your report view add the following lines for a single parameter
ReportParameter rp = new ReportParameter("title", title); this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); }); reportViewer1.RefreshReport();8.for multiple parameters
ReportParameter rp = new ReportParameter("title", title); ReportParameter rps = new ReportParameter("expense", totalExpense.ToString()); this.reportViewer1.LocalReport.SetParameters(new R`enter code here`eportParameter[] { rp }); this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rps }); reportViewer1.RefreshReport();
Upvotes: 0