I am currently using C sharp .net 6 and connecting to a database using System.Data.SqlClient.
When it attempts to read from a table, it returns the error: The Collation specified by SQL Server is not supported.
private const string SQLUSERS= @"SELECT * FROM USERS ORDER BY ID COLLATE German_PhoneBook_CI_AI;";
SqlConnection connection = new("...");
connection.Open();
try
{
using SqlCommand command = new(SQLUSERS, connection);
using SqlDataReader reader = await command.ExecuteReaderAsync();
while (await reader.ReadAsync())
{
...
}
The current server collation is German_PhoneBook_CI_AI and it is not possible for me to change it. Any alternatives to resolve this issue with the code and without using EF Core?
This seems to be an issue with .net 6, fixed in December 2021. I think your only hope is to make sure you're on the latest .net 6 version (6.0.16).