ActiveReports 16 .NET Edition
ActiveReports 16 User Guide / Concepts / Page Report/RDL Report Concepts / Data Binding / Connect to a Data Source
In This Topic
    Connect to a Data Source
    In This Topic

    In a Page report or an RDL report, you can connect to a data source at design time through the Report Explorer. You can also connect to a shared data source if you want to use the same data source for many reports. This topic describes the whole concept behind connecting to a data source.

    Add a data source

    Use the following steps to add a new data source in your report.

    1. In the designer, go to the Report Explorer-
      • Right-click the Data Sources node and select the Add Data Source option.

        Add icon in the Report Explorer
         
        Or,

      • Click the Add button and then select the Data Source option.

        Add icon in the Report Explorer
    2. In the Report Data Source dialog that appears, select the General page and enter the name of the data source. By default, the data source name is set to DataSource1. This name appears as a child node to the Data Sources node in the Report Explorer.
    3. Under Type, select the type of data source you want to use.
    4. Depending on the data source selected, different options/tabs are displayed to configure the connection.
      • For SQL or OleDb data sources, Connection Properties, Connection String, and Advanced Settings tabs appear.
      • For XML data source, the Connection Properties and Connection String tabs appear.
      • For JSON data source, the Content, Schema and Connection String tabs appear.
      • For other data source types, only the Connection String tab appears.
      Note: You can create dynamic connection strings by using the runtime variables, such as report parameters.
    5. Enter the configuration details for the chosen data source type. See Report Data Source dialog properties for more information.
    6. Click the OK button on the lower right corner to close the dialog. You have successfully connected the report to a data source.

    Custom Data Providers

    You can also implement some custom data providers such as SQLite, CSV, and Oracle by manually setting up the dependencies and configuration file. See the Custom Data Providers sample for complete implementation and ActiveReports Configuration File topic for information on setting up the configuration file. 

    Add a shared data source

    You can create a shared data source to use the same data source in different reports.

    Create a shared data source

    The following steps assume that you have already connected your report to a data source.

    1. Right-click the data source in the Report Explorer and select Share Data Source option.

      Create a shared data source
    2. In the Save Shared Data Source File dialog that appears, enter the file name and click the Save button to save the file in RDSX format.
      Notice that the data source icon changes to show sharing.
      Data Source Icon Shared Data Source Icon
      Data Source Icon Shared Data Source Icon

    Connect to a shared data source

    Follow the below steps to add a shared data source in your report.

    1. In the Report Explorer, click the Add icon on the top left and select Data Source or right-click the Data Sources node and select the Add Data Source option.    
    2. In the Report Data Source dialog that appears, select the General page and enter the name of the data source. This name appears as a child node to the Data Sources node in the Report Explorer.
    3. Check the Shared Reference checkbox.
    4. Under Reference, from the drop-down list, select From File.
    5. In the Shared Data Source File dialog that appears, go to the folder where your shared data source file is located and select it. A file path appears in the field adjacent to the Browse button.
    6. Click the OK button on the lower right corner to close the dialog. A shared data source node appears in the Report Explorer.

    Edit a data source

    These steps assume that you have already connected your report to a data source.

    1. To open the Report Data Source dialog, do one of the following:
      • In the Report Explorer, right-click a data source node and in the context menu that appears, select Edit or Edit Shared Data Source option.
      • In the Report Explorer toolbar, click the Edit button.
        Edit Shared Data Source button in Report Explorer toolbar
    2. In the Report Data Source dialog that appears, edit the data connection information.

    Report Data Source dialog properties

    The Report Data Source dialog provides the following pages where you can set data source properties.

    The General page of the Report Data Source dialog is where you can set the Name, Type, and Connection string of a new data source, or choose to use a shared data source reference.

    • Name: Enter a name for the data source. This name must be unique within the report. By default, the name is set to DataSource1.

    • Shared Reference: Select this check box to connect to a shared data source reference. See Add a Shared Data Source for further information. Once you have chosen the Shared Reference option, the Reference field to select a Shared Data Source becomes available. In the Reference field, select From File and select a shared data source file on your machine.

      If the Shared Reference checkbox is clear, you can select a data source type from the Type dropdown field.

    • Use Single Transaction: Check this option to execute the datasets using this data source in a single transaction.

    • Type: Choose the type of data source provider you want to use. The available options are Microsoft SQL Client Provider, Csv Provider, DataSet Provider, Object Provider, JSON Provider, Microsoft ODBC Provider, Microsoft OleDb Provider, and XML Provider.

      If you select SQL or OleDb as the data source Type value, the Connection Properties, Connection String and Advanced Settings pages appear under the Connection section. For XML data source, Connection Properties and Connection String pages appear. For JSON data source, Content, Schema, and Connection String pages appear. In other data source types, only the Connection String page appears.

    The Credentials page gives you the following four options for the level of security you need for the data in your report. This page is available if the data source Type value is set to Microsoft SQL Client Provider, Microsoft ODBC Provider, and Microsoft OleDb Provider.

    • Use Windows Authentication: Select this option when you know that any users with a valid Windows account are cleared for access to the data, and you do not want to prompt them for a user name and password.

    • Use a specific user name and password: Select this option when you want to allow only a single user name and password to access the data in the report.

    • Prompt for credentials: Select this option when there is a subset of users who can access the data. The Prompt string textbox allows you to customize the text requesting a user name and password from users.

    • No credentials: Select this option only if the data in the report is for general public consumption.