public int ObterTotalAcessos()
{
int obtertotal = 0;
using (var connection = ServiceLocator.ObterConexao())
{
var command = connection.CreateCommand();
command.CommandText = "SELECT SUM (ACESSOS) FROM USUARIO";
command.Parameters.AddWithValue("total", obtertotal);
var reader = command.ExecuteReader();
if (reader.Read())
{
// o erro está aqui v
obtertotal = reader.GetInt32(0);
}
}
return obtertotal;
}
So guys, my problem is occurring inside the (if). Displays error: Specified cast invalidates. Does anyone have a clue what it can be?