I need that, if the value is null, it would add the variable getid()
to the database.
string comando = "SELECT COUNT(*) FROM usuarios WHERE username=@Usuario AND senha=@Senha AND tipo=1";
var connection = new MySqlConnection(connString);
var cmd = new MySqlCommand(comando, connection);
cmd.Parameters.AddWithValue("@Usuario", usuario);
cmd.Parameters.AddWithValue("@Senha", senha);
var command = connection.CreateCommand();
connection.Open();
MySqlDataReader leitor = cmd.ExecuteReader();
while (leitor.Read())
{
hd_id = leitor["id"].ToString();
}
if (hd_id == null)
{
//Código aqui
}
int retorno = Convert.ToInt32(cmd.ExecuteScalar());
connection.Close();