Exemple #1
0
 private void buttonCadastrar_Click(object sender, EventArgs e)
 {
     try
     {
         Aluno a = new Aluno();
         a.Matricula = Int32.Parse(textBoxMatricula.Text.Trim());
         a.Nome      = textBoxNome.Text;
         AlunoBD dados = new AlunoBD();
         dados.Insert(a);
         MessageBox.Show("Aluno cadastrado com sucesso");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         AlunoBD dados = new AlunoBD();
         Aluno   a     = new Aluno()
         {
             Matricula = Int32.Parse(textBoxMatricula.Text),
             Nome      = textBoxNome.Text
         };
         dados.Insert(a);
         MessageBox.Show("Aluno cadastrado com sucesso");
     }
     catch (Exception ex)
     {
     }
 }