private void btnCadastrar_Click(object sender, EventArgs e) { try { bool trabalha = (rbSim.Checked) ? true : false; this.Cursor = Cursors.WaitCursor; Pessoa paciente = new Pessoa( txtNome.Text, txtSobrenome.Text, txtRG.Text, cbParentesco.Text, trabalha, Convert.ToInt32(txtIdade.Text), double.Parse(txtSalario.Text, CultureInfo.InvariantCulture)); cnSQL conexao = new cnSQL(); conexao.conecta(); conexao.cadastrarPessoa(paciente); } catch (Exception ex) { MessageBox.Show("Erro ao cadastrar paciente", ex.Message); } }
private void button1_Click(object sender, EventArgs e) { cnSQL cnSQL = new cnSQL(); MessageBox.Show(cnSQL.ToString()); cnSQL.conecta(); }