Bewerken

Delen via


Tutorial: Specify connection information (Reporting Services)

After you create your project and report definition file, you define a data source and configure connection information for the report to access data from a relational database or other sources.

In this tutorial, you:

  • Add the AdventureWorks2022 sample database as your data source.
  • Configure the connection string for the data source.

Prerequisites

  • Completion of Step 1: Create a report server project.
  • Ensure the database is in the default instance of SQL Server Database Engine and installed on your local computer.
  • Access to the AdventureWorks2022 sample database.

Set up a connection

When you create reports in SQL Server Reporting Services (SSRS), establishing a data source is crucial. Follow these steps to set up a connection between a data source and your reports.

  1. Open your Sales Order report definition file (.rdl) in Visual Studio.

  2. In the Report Data pane, select New > Data Source. If the Report Data pane isn't visible, then select View > Report Data.

    Screenshot of the Report Data pane with the Data Source option highlighted.

    The Data Source Properties dialog opens with the General section selected.

    Screenshot of the Data Source Properties dialog.

  3. In the Name box, enter "AdventureWorks2022".

  4. Select Embedded connection.

  5. From the Type list, select Microsoft SQL Server.

  6. In the Connection string box, enter:

    Data source=localhost; initial catalog=AdventureWorks2022

    Note

    This connection string assumes that SQL Server Data Tools (SSDT), the report server, and the AdventureWorks2022 database are all installed on the local computer.

    Change the connection string and replace "localhost" with the name of your database server/instance if the assumption isn't true. If you use SQL Server Express or a SQL Server named instance, modify your connection string to include instance information. For example:

    Data source=localhost\SQLEXPRESS; initial catalog=AdventureWorks2022

  7. Select Credentials. Choose the Use Windows Authentication (integrated security) option.

  8. Select OK. Report Designer adds the AdventureWorks2022 data source to the Report Data pane.

    Screenshot of the Report Data pane that highlights the AdventureWorks2022 data source.

Next step