Udostępnij za pośrednictwem


Converting RDL and RDLC Files

If you use both the ReportViewer controls and Microsoft SQL Server 2005 Reporting Services, you can reuse the reports that you create in both reporting technologies.

  • Reports that you create in SQL Server 2005 Reporting Services (saved as .rdl files) can be converted to the client report definition (.rdlc) file format used by the ReportViewer controls. This is called an RDL-to-RDLC conversion.

  • Reports that you create for ReportViewer controls (saved as .rdlc files) can be converted to the report definition (.rdl) file format used in SQL Server Reporting Services. This is called an RDLC-to-RDL conversion.

Comparing RDL and RDLC

RDL and RDLC files have important technical and terminology differences as described below:

  • RDL and RDLC are defined by an XML schema called the Report Definition Language. The schema for both file formats is identical. The schema is documented in SQL Server 2005 Books Online.

  • The ReportViewer control, which processes .rdlc files, ignores the <Query> element of RDL. If a report definition contains a query, the control will not process it.

Note

A client report definition (.rdlc) file will only contain a query if it originated as a .rdl file.

  • Dataset and data source terminology has different meanings in Visual Studio 2008 and SQL Server 2005. In Visual Studio, a dataset is a collection of data tables and is logically equivalent to a query or command that retrieves data. In Reporting Services, a dataset includes the following parts:

    • Data source information, including the data source type and connection string. The data source type specifies a data processing extension that is deployed on the report server.

    • Credential information that specifies how to obtain credentials for the data source connection.

    • Query or command information used to retrieve data.

Visually, an .rdlc file that is configured to run in a ReportViewer control has the dataset object, binding source object, and table object displayed at the bottom of the designer view. The following diagram provides an illustration of how these objects appear in a Windows form (the same data binding objects appear differently in a Web page):

Data objects in a project workspace

If you select an .rdlc file for use in a ReportViewer control and the data objects do not appear in the project, you are most likely looking at a renamed .rdl file that requires additional conversion steps to make it a fully functional .rdlc file.

The dataset name might be misleading; by default, Reporting Services uses the name of the data source for the first dataset that is created (for example, a dataset might be called "Northwind" even if it only retrieves data from one of the tables).

How to Convert Report Definitions

Only SQL Server 2005 RDL files can be converted to RDLC files. If you have RDL files from a previous version, you must upgrade them to SQL Server 2005 before migrating them to the .rdlc file format. To upgrade a report definition, open it in the SQL Server 2005 version of Report Designer.

Converting a report definition of either file type requires that you re-create data source and query information. Be sure to choose a data source schema that is the same as or structurally identical to the one used in the original report. If the schema is different, the report layout might not be valid for the data source you want to use. If you want to use different data sources, it is easier to re-create the report from the beginning rather than convert it.

RDL-to-RDLC Conversion

When converting a .rdl file to .rdlc format, you must manually replace the data source and query information in the report definition with data constructs provided in your application.

  1. Rename the .rdl file to use the .rdlc file extension.

  2. In Visual Studio 2008, open the solution or project that will contain the report.

  3. Create or add the dataset that defines the data you want to use to your projector solution. For more information, see Creating Data Sources for a Report.

  4. On the Project menu, click Add Existing Item and then select the .rdlc file that you created in the first step.

  5. In the project, open the form or Web page that will contain the report.

  6. From the Toolbox, in the Data group, drag a ReportViewer control onto the form or Web page.

  7. In the ReportViewer Tasks smart tags panel, in Choose Reports, select the .rdlc file to use with the control.

  8. In the ReportViewer Tasks smart tags panel, in Choose Data Sources, select the dataset you want to use. The dataset object, binding source object, and table object will appear at the bottom of the workspace. For more information about updating data source references, see Updating and Rebinding Data Source References (Visual Studio Report Designer).

  9. Save all files, and then build or deploy the project to verify that the report contains the data you expect.

RDLC-to-RDL Conversion

Converting an .rdlc file to the .rdl format is automatic if the following conditions are true:

  • The data source used by the .rdlc file uses integrated security.

  • Report data is provided through a data table. If the .rdlc uses data from a Business object, you must manually convert the .rdlc. A report server does not have the capability of processing Business objects in a report.

  • The data source used by the .rdlc file maps to one of the data processing extensions that is installed on the report server (for example, if the data source is a SQL Server database, you can use the SQL Server data processing extension that is installed by default on the report server).

  • The query and data source connection information do not need to be modified.

To convert the .rdlc automatically, you can rename the .rdlc file to .rdl, and then publish or upload the .rdl file to a report server. You can use Business Intelligence Development Studio in SQL Server 2005 to publish the .rdl file. For more information about creating report projects, publishing reports, and uploading files, see SQL Server 2005 Books Online.

To manually convert an .rdlc to an .rdl file format, follow these steps:

  1. Determine the data source that you want to use with the .rdl file. You can use a SQL Server relational database, an Analysis Service multidimensional database, an Oracle database, or any of the other supported data sources. The schema must be the same as the one you used to create the original .rdlc report layout.

  2. Rename the .rdlc file to use the .rdl file extension.

  3. In SQL Server 2005, in Business Intelligence Development Studio, create or open the Report Server project that will contain the report.

  4. On the Project menu, click Add Existing Item. Select the .rdl file you created in the first step and add it to the project.

  5. In Solution Explorer, open the .rdl file you just added to the project. The report definition opens in design mode. You should see the following tabs: Data, Layout, and Preview. Click Data to open the report in Data view.

  6. In Data view, select the first dataset and then click the Edit button () as illustrated in the following diagram:

    Icon for editing a dataset

  7. In the Dataset dialog box, click the Edit button () by the data source name.

  8. Update the connection information. You should replace the connection string so that the report connects to the data source you want to use. You might need to update the data source type, server, authentication options, and database selection.

  9. Click Run (!) to verify the data source returns the data you expect.

  10. Repeat the previous steps to modify any other data sources used in the report.

  11. Preview the report to verify that the data is merged into the report layout as expected. To preview the report, click the Preview tab.

See Also

Concepts

Deploying Reports and ReportViewer Controls
Configuring ReportViewer for Local Processing

Other Resources

Samples and Walkthroughs