Questions tagged [system.data.sqlclient]
34 questions
52
votes
8 answers
Why use a using statement with a SqlTransaction?
I've been running into some problems concerning a SqlTransaction I'm using in my code. During my Googling I see many people using a using statement with a SqlTransaction.
What is the benefit and/or difference of using this type of statement with a…

MDStephens
- 1,013
- 2
- 9
- 10
4
votes
2 answers
Checking if SQL Connection String specifies a parameter
I am looking for a robust method for checking in C# if a given SQL connection string explicitly specifies a certain parameter, e.g. "Encrypt=...". I tried parsing the string using SqlConnectionStringBuilder, expecting that ContainsKey() would tell…

Mo B.
- 5,307
- 3
- 25
- 42
4
votes
1 answer
How to avoid PlatformNotSupportedException when using TransactionScope and SQL connection pooling in .NET Core/.NET 5+
In a web service, I am querying a SQL Server 2016 database. Using a .NET TransactionScope as follows to keep transaction management in my service layer but data queries/commands in my data layer ("store" classes) code, we have a few places that…

Patrick Szalapski
- 8,738
- 11
- 67
- 129
2
votes
1 answer
WinForm Application cannot be started System.Data.SqlClient/Microsoft.Data.SqlClient is not supported on this platform
I have a WinForm Application which uses the System.Data.SqlClient package for connecting to the database.
If I start the application with Visual Studio (Debug/Release, Any CPU/x86/x64), everything works as expected, but if I create a Release with…

Nehl-IT
- 523
- 3
- 15
2
votes
1 answer
System.Data.SqlClient.SqlException (0x80131904): Timeout expired. Three different cases
I've started to encounter timeout errors, but not sure how to approach them because they are different each time.
First type of timeout
System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion…

Nikita Kalimov
- 56
- 1
- 5
2
votes
1 answer
Proper way to pass symmetric key using System.Data.SqlClient to SQL Server stored procedure that invokes exec sp_executesql
I have a column encrypted by a password-protected symmetric key in SQL Server 2017. On the server I can call sp_foo from another stored procedure like this:
declare @symkey_password varchar(50) = 'Where would we be without stackoverflow'
exec sp_foo…

Tim
- 8,669
- 31
- 105
- 183
1
vote
0 answers
C# ADO Azure SQL Interactive Authentication
I've been looking to see if .NET 4.8.0 supports Azure Interactive Authentication for environments where MFA is used.
Looking online it says it's possible with the version of System.Data.SqlClient in…

Tommy Newman
- 11
- 1
1
vote
1 answer
Can SQL Server return an informational message to .NET System.Data.SqlClient program in contexts that do not involve any error
Is it possible with a .NET client program, communicating with back-end SQL Server using the System.Data.SqlClient library, for the server to send an informational message to the client program in contexts that do not involve any error and for the…

Tim
- 8,669
- 31
- 105
- 183
0
votes
0 answers
System/Microsoft.Data.SqlClient is not supported on this platform .NET 8
I'm upgrading a Blazor Server app (.NET 5) to WebAssembly and .NET 8, and moving it from on-site to Azure. In the process of upgrading it, I started getting the error :
System/Microsoft.Data.SqlClient is not supported on this platform (I tried…

jnelson
- 41
- 1
- 10
0
votes
0 answers
What kind of problems can be caused by referencing both Microsoft.Data.SqlClient and System.Data.SqlClient
I was reading the answer to this question about the Microsoft.Data.SqlClient and System.Data.SqlClient which states that "Mixing up data providers isn't fun and should be avoided when possible." I'd like to know what kind of problems could be caused…

EyreCraggs
- 51
- 1
- 5
0
votes
0 answers
EF6 with AAD auth works locally, but not on deployed app in Azure
I'm working on an .Net 4.8 app using EF6. A decission was made to use AAD authentication so we've implemented usage of Microsoft.Data.SqlClient using ErikEJs ErikEJ.EntityFramework.SqlServer library.
The apps DBContext initially inherited…

ØTS
- 1
- 1
0
votes
0 answers
Using DbContext.Database.SqlQuery(sql,params) with a generic type
I'm finding myself using a very similar set of code over and over for different stored procedues
SqlParameter[] parameters = {
new SqlParameter("@somevar", 123),
new SqlParameter("@othervar", 456)
}
List result;
using (MyContext…

Kevin M
- 442
- 3
- 11
0
votes
1 answer
Azure functions + Azure SQL : session provider error 19 - physical connection is not usable
This starting to occcur today...
I was searchiong for a solution, but I just can find it using in different scenarions like outside the azure functions or using a different client library. Anyway...
This is my client:
using System;
using…

Marco Jr
- 6,496
- 11
- 47
- 86
0
votes
1 answer
ASP.NET Core. System.Data.SqlClient.SqlException - SSL_ERROR_SSL
My specs: PC with MS SQL Server 2008 (SP4) - 10.0.6535.0; PC on Linux (Debian GNU/Linux) with my ASP.NET Core 5.0 application (for sql - System.Data.SqlClient).
I can't make successful sql request to the remote SQL server.
Logger:
[2022-08-24…

Роман Кириллов
- 139
- 1
- 10
0
votes
0 answers
Cannont implicitly convert type 'Microsoft.Data.SqlClient.SqlConnection' to 'System.Data.SqlClient.SqlConnection'
I have a data set(.xsd) file I'm using in Visual Studio 2017 project and I've added a reference to 'Microsoft.Data.SqlClient' to it. In my constructor for a TableAdapter I have a line of code:
this._connection = new SqlConnection();
I get the error…

db_at_systems
- 3
- 1