This documentation is archived and is not being maintained.

Walkthrough: Using the ReportViewer Control in Remote Mode

This walkthrough shows how to programmatically configure the processing mode for a ReportViewer control. In this walkthrough, the processing mode is set for remote processing using a published report that runs on a SQL Server Reporting Services report server. Knowing how to set the processing mode in code is useful if you are creating an application that alternately hosts both local and server reports in the same control. If dynamic configuration is not an application requirement, you can set the processing mode at design time using the ReportViewer Tasks smart tag panel. For more information, see Using the ReportViewer Tasks Smart Tags Panel and Adding and Configuring the ReportViewer Controls.

You must have access to a SQL Server 2005 instance of Reporting Services, a sample database, and sample reports. This walkthrough assumes that you have the AdventureWorks sample database and the AdventureWorks sample reports that are available in SQL Server 2005.

Perform the following steps to configure the processing mode for a ReportViewer control in a Visual Studio Windows application project. For this example, you will be creating the application in Microsoft Visual C#.

  1. On the File menu, point to New, and then select Project.

  2. In the Project Types pane, expand Visual C# and choose Windows.

  3. In the Templates pane, choose Windows Application to create a Microsoft Windows application.

  4. In the Name box, type the name of the project: ReportViewer Remote Processing.

  5. In the Location box, enter the directory in which you want to save your project, or click Browse to navigate to it. The Windows Forms Designer opens, showing Form1 of the project you created.

  1. Click on Form1. Resize the form as desired.

  2. From the Data section of the Visual Studio toolbox, drag the ReportViewer icon to the form.

  3. Open the smart tags panel of the ReportViewer control by clicking the triangle on the top right corner. Click Dock in parent container.

  1. From the smart tags panel, click the Choose Report drop-down list. Double-click <Server Report>. The smart tags panel expands to show Report Server Url and Report Path textboxes.

  2. In Report Server Url, enter the Url for the report server. For example, you could type http://myservername/reportserver.

  3. In the Report Path, enter the path of the report on the server. The path name begins with the root / and includes the folders and report name. For example, you could type /AdventureWorks Sample Reports/Company Sales.

  4. To set additional server report properties, from the View menu, select Properties Window. From the reportviewer properties, expand the ServerReport node. You can now set additional properties such as DisplayName, HistoryId and Timeout.

  1. On the Build menu, click on Build Solution to build the application. As part of the build process, the report is compiled and any errors found (such as a syntax error in an expression used in the report) are added to the Task List.

  2. Press F5 to run the application.