When I run the C# .NET 6.0 library from my console program, I havn't problem with System.Data.SqlClient
or Microsoft.Data.SqlClient i tested with two DLL , but if I call the dll with another .exe
program in .NET 6.0, I get an exception for two dll System.Data.SqlClient` or Microsoft.Data.SqlClient and also oledb dll.
System.PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform
My code:
using (var connection = new SqlConnection(connectionString))
{
using (var cmd = new SqlCommand(queryString, connection))
{
cmd.Connection = connection;
connection.Open();
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
return true;
}
}
}
}