Hi,
I have the following situation:
using (SqlConnection conexao = new SqlConnection(ConnectionString))
{
SqlCommand comando = new SqlCommand(query, conexao);
comando.Parameters.AddWithValue("id", idUsuario);
conexao.Open();
SqlDataReader reader = comando.ExecuteReader(CommandBehavior.SingleRow);
if (reader.Read())
{
Hydrate(out entity, reader);
}
}
So, if reader
contains valid results and HasRows == true
, then reader.Read()
should return true, right?
Well, it doesn't for me. I have no idea of what is going on, because the Hydrate(out entity, reader);
line is never getting hit.
Can someone please help me understand this?
Thank you!