Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open ssrs report from asp web page using report viewer

I'm trying to open an ssrs report on my web pages using ReportViewer. For the Report Serverl URL I have:

http://db_servers/ReportsServer_SENSORSQLSERVER

and for my report path I have:

http://db_servers/ReportsServer_SENSORSQLSERVER/Pages/ReportViewer.aspx?%2fCustomer1&rs:Command=Render.

I have looked through many sites and tutorial on how to add URL but I still get an error saying: The length of my link must be below 260 characters long. (rsInvalidItemPath). I also want to mention that my report server is in Native mode. My report server is located in another computer so I made sure the processing mode on my report viewer is remote. Whenever I go to the surver url I can clearly see the list of my reports and when I click on a report I can see it as well so I know my urls are correct. I have tried including a slash in front of my report path url, replacing "2%f" with a space. Nothing seems to work. Any idea? Thanks.

like image 966
Rick Avatar asked Sep 26 '12 18:09

Rick


People also ask

How do I use report viewer?

Locate the ReportViewer control in the Toolbox. If the Toolbox is not visible, you can access it from the View menu by selecting Toolbox. Drag the ReportViewer control onto the design surface of the Windows Form. A ReportViewer control named reportViewer1 is added to the form.

HOW include SSRS report in asp net?

Under Installed | Templates, select Visual C# | ASP.NET Core | C1 ReportViewer View Page (ASP.NET Core) to open the C1 MVC ReportViewer dialog. In the C1 MVC ReportViewer dialog, select Report in SSRS server option. In the SSRS server field, enter a SSRS server URL to access the reports.


2 Answers

This is an old one but I bumped into it for a client. To get the report URL, I found it easiest to connect to the SQL instance that the Report Server is running on via SSMS, then open the ReportServer database, and query the Catalog table for the path fields.

like image 81
Greg Sipes Avatar answered Oct 14 '22 10:10

Greg Sipes


You need to separate out the URL to the server, report path and add the parameters to a parameters array.

Here's a sample:

    protected void Page_Init(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        // Set the processing mode for the ReportViewer to Remote
        reportViewer.ProcessingMode = ProcessingMode.Remote;

        ServerReport serverReport = reportViewer.ServerReport;

        // Set the report server URL and report path
        serverReport.ReportServerUrl =
            new Uri("http://<Server Name>/reportserver");
        serverReport.ReportPath =
            "/AdventureWorks Sample Reports/Sales Order Detail";

        // Create the sales order number report parameter
        ReportParameter salesOrderNumber = new ReportParameter();
        salesOrderNumber.Name = "SalesOrderNumber";
        salesOrderNumber.Values.Add("SO43661");

        // Set the report parameters for the report
        reportViewer.ServerReport.SetParameters(
            new ReportParameter[] { salesOrderNumber });
    }
}

Above taken from Using the WebForms ReportViewer Control.

like image 21
Kevin LaBranche Avatar answered Oct 14 '22 09:10

Kevin LaBranche