0
votes

I have deployed my SSRS reports in the server. Is it possible for me to access that report from my local web application. I have given the server's credentials in the web.config. But still its not displaying the report and it shows some error like Cannot create a connection to data source 'DataSource1'. (rsErrorOpeningConnection).

When I hosted the same application in the server it is working absolutely fine.

Can anyone tell me why am not able to access the reports from my local system?

1

1 Answers

1
votes

This is not my code, but ideally is all you have to do. I remember using it successfully in one of previous projects some time back

private void ShowReport()
{
    try
    {
        string urlReportServer = "http://sqlDBServer//Reportserver";
        rptViewer.ProcessingMode = ProcessingMode.Remote; // ProcessingMode will be Either Remote or Local
        rptViewer.ServerReport.ReportServerUrl = new Uri(urlReportServer); //Set the ReportServer Url
        rptViewer.ServerReport.ReportPath = "/ReportName"; //Passing the Report Path                

        //Creating an ArrayList for combine the Parameters which will be passed into SSRS Report
        ArrayList reportParam = new ArrayList();
        reportParam = ReportDefaultPatam();

        ReportParameter[] param = new ReportParameter[reportParam.Count];
        for (int k = 0; k < reportParam.Count; k++)
        {
            param[k] = (ReportParameter)reportParam[k];
        }
        // pass crendentitilas
        //rptViewer.ServerReport.ReportServerCredentials = 
        //  new ReportServerCredentials("uName", "PassWORD", "doMain");

        //pass parmeters to report
        rptViewer.ServerReport.SetParameters(param); //Set Report Parameters
        rptViewer.ServerReport.Refresh();
    }
    catch (Exception ex)
    {
        throw ex;
    }
}

Ref: http://www.codeproject.com/Articles/675762/Call-SSRS-Reports-by-using-Csharp