I am counting all the rows from a data reader, for that I am doing this:
connection = new NpgsqlConnection(CS);
connection.Open();
command = new NpgsqlCommand(cmd, connection);
dataReader = command.ExecuteReader();
while (dataReader.Read())
{
res++;
}
Where CS is my connection string, with the format Server=server_here;Port=port_here;User Id=username_here;Password=password_here;Database=database_here;. After a certain number of records, I get an exception with the following message:
ERROR: 22021: invalid byte sequence for encoding \"UTF8\": 0xbb
I am using postgres 9.4, and the Npgsql version (downloaded from nuget) is 3.2.2. My database encoding is SQL_ASCII, is there any way for me to successfully read the full data reader without changing the data base encoding?