Pro SQL Server 2012 Reporting Services

(sharon) #1
CHAPTER 9  RENDERING REPORTS FROM .NET APPLICATIONS

You’ll now start adding the code necessary to use the new Report Viewer control to render the SSRS
2012 reports.


Figure 9-3. The ViewerRVC.cs form


Coding the Viewer Form


First, add a using statement for the new namespace, Microsoft.Reporting.WinForms, to the top of the
class with the other namespace declarations. Doing this will allow you to access the members of the
namespace without typing the full namespace each time you use a method or property from that
namespace. Right click on the ViewerRVC.cs file and select view code to add this using statement to the
file.


using Microsoft.Reporting.WinForms;


Second, add the code shown in Listing 9-2 to the Run Server button’s click event. Make sure the
ViewerRVC.cs form is open in design view, and double-click the Run Server button. This will create an
empty method to handle the button’s click event.

Free download pdf