private void btnCadastrar_Click(object sender, System.EventArgs e) { try { if (validaCampos()) { string efetuado = ""; if (btnCadastrar.Text == "Cadastrar") { ConexaoOracle.ComandoComParametro($"insert into maquina values ('', '{txtHostname.Text}', '{txtIP.Text}', '{txtModelo.Text}', '{txtSetor.Text}', :anexo, sysdate)", imageBytes); efetuado = "cadastrada"; } else if (btnCadastrar.Text == "Editar") { ConexaoOracle.ComandoComParametro($"update maquina set hostname = '{txtHostname.Text}', ip = '{txtIP.Text}', modelo = '{txtModelo.Text}', setor = '{txtSetor.Text}', foto = :anexo where id = {idSelected}", imageBytes); efetuado = "editada"; btnVoltar.PerformClick(); } MessageBox.Show("Máquina " + efetuado + " com sucesso", "Cadastrado!", MessageBoxButtons.OK, MessageBoxIcon.Information); limparCampos(); atualizarMaquinas(); limparCelulas(); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message); } }