0
Good afternoon gentlemen.
I am making a user registration in the college work and when logging in this error appears.
How can I solve?
private Usuario Mapear(DataRow registro)
{
var usuario = new Usuario();
usuario.Nome = Convert.ToString(registro["NOME"]);
usuario.Senha = Convert.ToString(registro["SENHA"]);
usuario.Email = Convert.ToString(registro["EMAIL"]);
usuario.Telefone = Convert.ToString(registro["TELEFONE"]);
usuario.Status = (Status)Convert.ToInt32(registro["STATUS"]);
//usuario.Funcao = Convert.ToString(registro["FUNCAO"]);
//usuario.Setor = Convert.ToString(registro["SETOR"]);
return usuario;
}
I don’t know how to proceed. I’ve tried almost everything.
What value is this field
registro["STATUS"]
returns?– Pedro Paulo
Don’t use high-end, young man. It’s ugly, kkkkk
– Wallace Maxters
Probably the data ( record["STATUS"]) is returning a null value, so it is not possible to convert to int. Just to confirm, before converting display what is being brought, so we can check
– Clayton Tosatti
Use an ORM, don’t waste time.
– Gabriel