Search results

Load SSRS rdl reports

Report Viewer has support to load RDL reports from SSRS Report Server. To render SSRS Reports set the ReportServerUrl and ReportServerCredential properties as in the following code snippet.

this.reportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.reportViewer.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
this.reportViewer.ReportPath = "/SSRSSamples/Territory Sales"; //The report path should be in the format of  "/folder name/report name"
this.reportViewer.RefreshReport();

Set data source credential for shared data sources

The SSRS Report Server does not provide options to get credential information of the report data source deployed on the SSRS server. If the report has any data source that uses credentials to connect with the database, then you must specify the DataSourceCredentials for each report data source to establish database connection.

this.reportViewer.ReportLoaded += (sen, arg) =>
{
    List<BoldReports.Windows.DataSourceCredentials> dataSourceCrdentials = new List<BoldReports.Windows.DataSourceCredentials>();

    foreach (var dataSource in this.reportViewer.GetDataSources())
    {
        BoldReports.Windows.DataSourceCredentials crdentials = new BoldReports.Windows.DataSourceCredentials();
        crdentials.Name = dataSource.Name;
        crdentials.UserId = "ssrs1";
        crdentials.Password = "RDLReport1";
        dataSourceCrdentials.Add(crdentials);
    }

    this.reportViewer.SetDataSourceCredentials(dataSourceCrdentials);
};
this.reportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.reportViewer.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
this.reportViewer.ReportPath = "/SSRSSamples/Territory Sales"; //The report path should be in the format of  "/folder name/report name"
this.reportViewer.RefreshReport();

Data source credentials must be added for shared data sources that do not have credentials in the connection strings.

Render linked reports

You can render a linked report that point to an existing report, which is published in the SSRS Report Server. Also, it is possible to set the parameter, data source, credential, and other properties as like normal SSRS reports using the Report Viewer.

this.reportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.reportViewer.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
this.reportViewer.ReportPath = "/SSRSSamples/Territory Sales_Link"; //The report path should be in the format of  "/folder name/report name"
this.reportViewer.RefreshReport();

The Territory Sales_Link is a linked report created for Territory Sales report that is already available on the SSRS Report Server.