New to Telerik Reporting? Download free 30-day trial

Overview

The Microsoft.Data.SqlClient namespace is essentially a new version of the System.Data.SqlClient namespace and can thus be used for connecting to Microsoft SQL Databases.

Setting up the Microsoft.Data.SqlClient Data Provider in the .NET Standalone Report Designer

  1. Create a new .NET 8 Console Application project.
  2. Install the Microsoft.Data.SqlClient NuGet package to it and build the project.
  3. Navigate to the bin/Debug/net8.0 subdirectory of the project, and copy all assemblies there except for the assembly with the name of the project.
  4. Paste the assemblies in the .NET Standalone Report Designer installation directory e.g. C:\Program Files (x86)\Progress\Telerik Reporting 2024 Q3\Report Designer\.NET.
  5. The bin/Debug/net8.0 folder of the console application should contain an additional folder named runtimes with several subfolders such as win, unix, win-x64, etc. Copy the DLLs from the folders that correspond to your Operating System and CPU architecture.
  6. Paste the additional runtime assemblies in the .NET Standalone Report Designer installation directory e.g. C:\Program Files (x86)\Progress\Telerik Reporting 2024 Q3\Report Designer\.NET.
  7. Restart the designer if you have previously opened it.
  8. Add a new SQL DataSource and you should see that the Microsoft.Data.SqlClient Data Provider is in the dropdown.

Setting up the Microsoft.Data.SqlClient Data Provider in .NET Applications

.NET Application with the Web Report Designer

  1. Install the Microsoft.Data.SqlClient NuGet package to it and build the project.
  2. Register the SqlClientFactory.Instance in the Telerik.Reporting.Processing.Data.DbProviderFactories using the RegisterFactory method within the static constructor of the controller that inherits from ReportDesignerControllerBase. For example:

    [Route("api/reportdesigner")]
    public class ReportDesignerController : ReportDesignerControllerBase
    {
    
            static ReportDesignerController()
            {
                Telerik.Reporting.Processing.Data.DbProviderFactories.RegisterFactory("Microsoft.Data.SqlClient", Microsoft.Data.SqlClient.SqlClientFactory.Instance);
            }
            public ReportDesignerController(IReportDesignerServiceConfiguration reportDesignerServiceConfiguration, IReportServiceConfiguration reportServiceConfiguration)
                : base(reportDesignerServiceConfiguration, reportServiceConfiguration)
            {
            }
    }
    
  3. If the SqlDataSource component uses a shared connection where it is retrieved from the configuration file of the project(e.g. appsettings.json), the provider name must be specified in the connection. For example:

    {
            "ConnectionStrings":{
                "mssql":{
                    "connectionString":"Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;",
                    "providerName":"Microsoft.Data.SqlClient"
                }
            }
    }
    

.NET Application with Web Report Viewer

  1. Install the Microsoft.Data.SqlClient NuGet package to it and build the project.
  2. Register the SqlClientFactory.Instance in the Telerik.Reporting.Processing.Data.DbProviderFactories using the RegisterFactory method within the static constructor of the controller that inherits from ReportsControllerBase. For example:

    [Route("api/reports")]
    public class ReportsController : ReportsControllerBase
    {
    
            static ReportsController()
            {
                Telerik.Reporting.Processing.Data.DbProviderFactories.RegisterFactory("Microsoft.Data.SqlClient", Microsoft.Data.SqlClient.SqlClientFactory.Instance);
            }
            public ReportsController(IReportServiceConfiguration reportServiceConfiguration)
                : base(reportServiceConfiguration)
            {
            }
    }
    
  3. If the SqlDataSource component uses a shared connection where it is retrieved from the configuration file of the project(e.g. appsettings.json), the provider name must be specified in the connection. For example:

    {
            "ConnectionStrings":{
                "mssql":{
                    "connectionString":"Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;",
                    "providerName":"Microsoft.Data.SqlClient"
                }
            }
    }
    

See Also

In this article