38 questions
1 vote
1 answer
184 views
TypeLoadException updating from System.Data.SqlClient to Microsoft.Data.SqlClient
I have an ASP.NET Core 8 Web API that is using a private Nuget package built on .NET 8 that we use to hold common logic for our database access. We are currently using Dapper and System.Data.SqlClient ...
0 votes
2 answers
184 views
How can I prevent SqlException (0x80131904): Login failed for user on .NET 8 Blazor Web App when deployed to Azure, with multiple connections at once?
I am using the .NET 8 Blazor web app template. I have been programming locally for a while with no issues. I recently tried to deploy my web app to azure, however I keep running into an error ...
0 votes
0 answers
73 views
System.TypeLoadException on SqlConnection.Open method call
I have a console application which has a reference to the project which has package Microsoft.Data.SqlClient. I am trying to fetch data from SQL Server using ADO.NET with the following method private ...
0 votes
1 answer
91 views
Microsoft.Data.SqlClient SqlParameter not passing size to Azure SQL Server
I have a view in an Azure SQL Server database, and I am querying that view using the Microsoft.Data.SqlClient package. However, when I use parameters in my SqlCommand through the use of SqlParameter, ...
0 votes
0 answers
59 views
How to access the Exception that caused a SQLCLR Exception
I have a SQLCLR scalar function that uses the context connection to read data. Sometimes, the SQL statement being run by the CLR deadlocks. The scalar function itself is being run in a standard stored ...
1 vote
1 answer
619 views
Why is Microsoft.Data.SqlClient throwing TypeInitializationException when loading Microsoft.Identity.Client at runtime?
I have an Entity Framework 6 model (code-first, with migrations enabled and auto-migrations disabled) in a class library that targets .NET 4.8 and .NET Standard 2.1 (AnyCPU). This is an SDK-style ....
0 votes
0 answers
242 views
Can't connect to encrypted SQL Server connection using Microsoft.Data.SqlClient
I have a .NET Core website where I've replaced the deprecated System.Data.SqlClient library with Microsoft.Data.SqlClient, and can no longer connect to the default SQL Server instance on my server. I ...
0 votes
0 answers
64 views
ASP.NET MVC web app on .NET 4.7.1 updated Microsoft.Data.SqlClient Nuget Update from 1.1.0 to 5.2.2/4.0.6
My ASP.NET MVC web app on .NET 4.7.1 updated Microsoft.Data.SqlClient Nuget package from 1.1.0 to 5.2.2. I get this error: Microsoft.Data.SqlClient.SqlException: 'A network-related or instance-...
3 votes
1 answer
179 views
Is SqlException.Number unique for SQL Server exceptions?
In Microsoft.Data.SqlClient/System.Data.SqlClient libraries, the Sql errors returned with the SqlException have a property called Number. In many of StackOverflow questions and other discussions over ...
0 votes
2 answers
4k views
Getting Microsoft.Data.SqlClient trusted certificate error though not using that driver
I am using Visual Studio 2022 - v17.9.6. When I try to modify or add either a typed dataset or an Entity Framework (v6) model from an existing SQL Server database, I get an error regarding a trusted ...
3 votes
2 answers
7k views
SQL Server error 31 - "Encryption(ssl/tls) handshake failed", in an AWS Lambda function
I have an AWS Lambda function (REST Api), which has been running for years, that just queries a stored procedure on a remote SQL Server. I wanted to make some changes to it and took the opportunity to ...
0 votes
0 answers
95 views
Microsoft.Data.SqlClient.SqlException when connecting to a Fabric datawarehouse trough a COM DLL
I have created a COM-DLL to connect to a Fabric datawarehouse. Using the Microsoft.Data.SqlClient Nuget library. When using the DLL from antother VStudio Project works fine. But when I'm using the DLL ...
3 votes
1 answer
7k views
How do I add a new connection in Excel?
I have an existing Excel 365 file with multiple data connections. I want to add a new connection, but I can't figure out how. I can see the existing connections by clicking Data->Queries & ...
0 votes
2 answers
123 views
NullReferenceException in F# interactive
I'm using microsoft.data.sqlclient library. I’m trying to execute this simple code in F# interactive: #r @"C:\Users\micha\.nuget\packages\microsoft.data.sqlclient\5.1.0\ref\net6.0\Microsoft.Data....
0 votes
1 answer
432 views
SqlException: Login failed for user '<token-identified principal>'
I'm using below connection string to connect AZURE SQL server, however We see below error. Please advice Connection string: Data Source=servername.database.windows.net;Encrypt=True;Initial Catalog=...