You can connect to a Microsoft SQL Server database using the Telerik SqlDataSource component. To do this, you need a connection string and access rights to a SQL Server database. Then, you can use the SqlDataSource component to provide data to data items (Report, Table, Chart).

To connect to a SQL Server database using the SqlDataSource component

  1. In Microsoft Visual Studio, open a Telerik Report. From the Telerik Reporting R3 2020 group in the Toolbox, select the SqlDataSource component and click on the design surface to add it to the Report.

  2. Choose your Data Connection dialog box appears.

  3. Click New Connection

    • If the Change Data Source dialog box appears, click Microsoft SQL Server, and then click Continue.
  4. In the Add Connection dialog box, click Change.

  5. In the Change Data Source dialog box, click Microsoft SQL Server, and then click OK.

  6. In the Server name box, enter the name for your SQL Server database, and then under Logon to the server, enter the logon credentials.

    • For the logon credentials, select the option that is appropriate for accessing and running the SQL Server database (either by using Microsoft Windows integrated security or by providing a specific ID and password) and, if it is required, enter a user name and password.

  7. In the Select or enter a database name list, enter a valid database on the server e.g. AdventureWorks.

  8. Optionally, click Test connection to verify that your connection works.

  9. Click OK, Click Next to continue and select Yes, save this connection…. Enter a name for your connection for when it is stored in the application configuration file, and then click Next.

  10. Select the stored procedure from which to retrieve results e.g. uspGetEmployeeManagers and click Next.

    • If the stored procedure has a parameter, the Configure Data Source Parameters step shows. You can leave the sql parameter value blank and continue, create an expression or create a report parameter as values. Choosing the last option would give you ability to use the built-in report parameters to specify value at run time. The SqlDataSource component submits the text in the SelectCommand property to the database, and the database returns the result of the stored procedure back to the SqlDataSource component. Any data items that are bound to the data source component would display the result set on your report.

  11. To test your query, click Next, and then click Execute Query.

  12. Click Finish. The Wizard would close and the SqlDataSource component would be ready for use by the data items.

In this article
Not finding the help you need?