Hi There,
I may be mistaken, but
.rdl files belong to SQL Reporting Services (SSRS), and ReportViewer is the winforms/webforms control that handles
.rdlc files. Your code sample seems to belong to a webform.
Having mentioned that, most of the required code for both winforms/webforms is basically the same, but there are some minor differences that must not be ignored.
Webform example(rptVwr is the name I gave to the ReportViewer control):
DataSet ds = Your method to get the required data;
rptVwr.ProcessingMode = ProcessingMode.Local;
rptVwr.LocalReport.EnableExternalImages = true;
rptVwr.LocalReport.ReportPath = "Reports/DTE.rdlc";
rptVwr.LocalReport.DataSources.Clear();
rptVwr.LocalReport.DataSources.Add(new ReportDataSource("Dcto", ds.Tables[0]));
rptVwr.LocalReport.DataSources.Add(new ReportDataSource("Events", ds.Tables[1]));
rptVwr.LocalReport.DataSources.Add(new ReportDataSource("AuxData", ds.Tables[2]));
rptVwr.LocalReport.Refresh();
Winforms Example (RepVwer is the name I gave to the ReportViewer control):
... DataSet ds = here goes your method to get the required data;
RepVwer.ProcessingMode = ProcessingMode.Local;
RepVwer.LocalReport.ReportEmbeddedResource = "DTEViewer.rdlc.DTE.rdlc";
RepVwer.LocalReport.DataSources.Clear();
RepVwer.LocalReport.DataSources.Add(new ReportDataSource("IdDoc", ds.Tables[0]));
RepVwer.LocalReport.DataSources.Add(new ReportDataSource("Emi", ds.Tables[1]));
RepVwer.LocalReport.DataSources.Add(new ReportDataSource("Recep", ds.Tables[2]));
RepVwer.LocalReport.DataSources.Add(new ReportDataSource("Details", ds.Tables[3]));
RepVwer.LocalReport.DataSources.Add(new ReportDataSource("Totals", ds.Tables[4]));
this.RepVwer.RefreshReport();
If your need to pass parameters to a report, create the array, assign all needed values, and add it to the report:
ReportParameter[] repParams = new ReportParameter[3];
repParams[0] = new ReportParameter("MyParam1", "false");
repParams[1] = new ReportParameter("MyParam2", nroOper);
repParams[2] = new ReportParameter("MyParam3", "blah, blah, blah!");
LocReport.LocalReport.SetParameters(repParams);
That's how I configure ReportViewer controls, assign the report to use, bind data, and finally display them.
Hope this helps; cheers!