If you have written any reporting applications in .NET, you may be familiar with Crystal Reports and/or Microsoft SQL Server Reporting Services.
The ReportViewer control is a new addition to Visual Studio 2005, which is actually a Reporting Services component. This control has two versions - Windows Forms version and Web version. As you may presume, Windows Forms version is used to write reporting applications in Windows Forms applications and Web version is used to write ASP.NET Web applications.
Report Processing Modes
The ReportViewer control supports two report processing modes - local and remote.
In local processing mode, the ReportViewer control runs within the client application and the report processing is performed as a local process on the client machine where actual application is running.
In remote processing mode, the ReportViewer control runs on a SQL Server 2005 Reporting Services report server. In this mode, the ReportViewer control is used to view the report that is already generated on the server. All processing from data retrieval to report rendering is performed on the report server. To use remote processing mode, you must have a licensed copy of SQL Server 2005 Reporting Services.
Both Windows and Web controls can be configured to run in local processing mode or remote processing mode.
Namespace and Assembly
The ReportViewer control assemblies for Windows Forms and Web Forms versions are Microsoft.ReportViewer.WinForms and Microsoft.ReportViewer.WebForms respectively. You must have to import the namespace in your application before start using the ReportViewer control. If you use add the ReportViewer control by dragging and dropping from the Toolbox, the namespace and assembly references are added for you automatically.
Create a Simple Report
Now let's create a simple report using the ReportViewer control. In this application, I will load data from a SQL Server database to generate reports.
Summary
The ReportViewer control available in Visual Studio 2005 makes reporting easier for .NET developers. This article was a basic introduction to ReportViewer control and how to get started with it. Now having Reporting Services component available in Visual Studio, you don't have to deal with Crystal Report, its distribution and licensing issues.