Geeks With Blogs
Patrice Calve Life's short, have fun

Step 1: prepare yourself :)

The first step to show a report on a windows application is to figure out the url and path of the report!

Sql Reporting Services has 2 virtual directories:

  • /Reports: renders the reports to the user in a user-friendly web page
  • /ReportServer: executes the report

When your boss asks you to display a report in a winform application, he(she) will likely send you a url in the following forms:

The urls above don't translate to properties that you need in a winform (or webform)...

To "consume" a report from a winform, you can't use the url above, you need another url.  Actually, you need two things:

  1. The Report Server Url
  2. The Path of the report

In the following two(2) steps, we'll see how to figure out how to discover that information.

Step 2: The Report Server Url

Ask your administrator, or find it for yourself!  The Reporting Server url is hidden in the report!

  • Open the report in a browser (ie)
  • Right click on the report's header (ex: on the report's title) -> View Source
  • Locate the meta tag "Report Server", the "Content" attribute will contain the Report Server value: ex
    • <META Name="Report Server" CONTENT="HTTP://ReportingServices/reportserver">

{ReportServerUrl} = "HTTP://ReportingServices/reportserver"

Step 3: The Report Path

The Report Path is something you have to "build" manually.

  • Open the ServerUrl in the browser (ie), a page with a list of folders will be shown
  • Copy the text of the folder into notepad or something like that. (referred bellow as {MyFolder})
  • Navigate to the folder, a page with a list of reports will be shown
  • Copy the text of the report into notepad: (referred bellow as {MyReportName})

The ReportPath will be the following: /{MyFolder}/{MyReportName}

ex: {ReportPath} = "/TMF Reports/TMF1200 - Project Status"

 

Step 4: The ReportViewer in the Winform

Now, you're ready to add the report on the winform.

  • Open the winform in Visual Studio
  • Add a ReportViewer on the designer (Toolbox > Data > ReportViewer)
  • Set the following properties:

Run the application.

Pat

Note To Microsoft

It would nice if it was easier to discover reports from within Visual Studio.  A wizard where a dev could enter any of the following:

Thanks, Pat

Posted on Friday, March 13, 2009 2:21 PM | Back to top


Comments on this post: How to display a Reporting Services Report in a Winform application

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
i want to locate the reportserver url and path for my web application.
i tried to open my report which is a rdl file in internet explorer.
i m unable to open it to locate the meta tag...
Left by arun on May 19, 2009 12:18 AM

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
I have never been working with services reports so far, but now I have this job where they learn me how to do it. I can`t say how much it helped me to read your articles and get a closer look to the report server Url and the report path.
Left by dll file extension on Apr 11, 2011 4:20 AM

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
Poda loosu
Left by dsfd on Jun 10, 2011 1:32 AM

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
Gotta say how useful this was, awesome info, phew!
Left by Jam on Feb 12, 2013 8:57 AM

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
The meta tag tip saved me, thnx!
Left by Lou on Sep 03, 2014 2:06 PM

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
THANK YOU SO MUCH!!!! I have searched for hours on how to do this, and you provided the best and most straight forward steps to complete the task!!!!!!!!!

THANKS^1000000000000
Left by Andrew on May 27, 2015 6:39 PM

# re: How to display a Reporting Services Report in a Winform application
Requesting Gravatar...
Useful as a CRACK xD.
Now, how can u do this for a dynamic report viewer with many reports without doing it one by one, i mean, setting the path property for every report dynamically?
Left by IngSys on Jul 06, 2016 3:46 PM

Your comment:
 (will show your gravatar)


Copyright © Patrice Calvé | Powered by: GeeksWithBlogs.net