| title | Using the Microsoft SQL Client Data Provider |
|---|---|
| page_title | Integrating the Microsoft SQL Client Data Provider |
| description | Learn more about how the Microsoft SQL Client data provider can be used by the SqlDataSource component to connect to MS SQL databases in Telerik Reporting. |
| slug | telerikreporting/designing-reports/connecting-to-data/data-source-components/sqldatasource-component/using-data-providers/using-microsfost-data-sqlclient-data-provider |
| tags | Microsoft.Data.SqlClient,data,provider |
| published | true |
| position | 4 |
| reportingArea | General |
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.
- Create a new .NET 8 Console Application project.
- Install the Microsoft.Data.SqlClient NuGet package to it and
buildthe project. - Navigate to the
bin/Debug/net8.0subdirectory of the project, and copy all assemblies there except for the assembly with the name of the project. - Paste the assemblies in the .NET Standalone Report Designer installation directory e.g.
C:\Program Files (x86)\Progress\Telerik Reporting {{site.suiteversion}}\Report Designer\.NET. - The
bin/Debug/net8.0folder of the console application should contain an additional folder namedruntimeswith several subfolders such aswin,unix,win-x64, etc. Copy the DLLs from the folders that correspond to your Operating System and CPU architecture. - Paste the additional runtime assemblies in the .NET Standalone Report Designer installation directory e.g.
C:\Program Files (x86)\Progress\Telerik Reporting {{site.suiteversion}}\Report Designer\.NET. - Restart the designer if you have previously opened it.
- Add a new SQL DataSource and you should see that the
Microsoft.Data.SqlClientData Provider is in the dropdown.
-
Install the Microsoft.Data.SqlClient NuGet package to it and
buildthe project. -
Register the SqlClientFactory.Instance in the
Telerik.Reporting.Processing.Data.DbProviderFactoriesusing theRegisterFactorymethod within thestaticconstructor of the controller that inherits from ReportDesignerControllerBase. For example:{{source=CodeSnippets\Blazor\Docs\Controllers\ReportDesignerControllerMicrosoftDataSqlClient.cs region=NET_Application_with_the_Web_Report_Designer}}
-
If the SqlDataSource component uses a
sharedconnection 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" } } }
-
Install the Microsoft.Data.SqlClient NuGet package to it and
buildthe project. -
Register the SqlClientFactory.Instance in the
Telerik.Reporting.Processing.Data.DbProviderFactoriesusing theRegisterFactorymethod within thestaticconstructor of the controller that inherits from ReportsControllerBase. For example:{{source=CodeSnippets\Blazor\Docs\Controllers\ReportsControllerMicrosoftDataSqlClient.cs region=NET_Application_with_Web_Report_Viewer}}
-
If the SqlDataSource component uses a
sharedconnection 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" } } }
- How to Use Microsoft.Data.SqlClient Data Provider in Web Report Designer
- Adding External Data Provider to .NET Standalone Designer
- How to register a DbProviderFactory in a .NET Core project
- Microsoft SqlClient Data Provider for SQL Server connection strings