private void btnSkapaAlumn_Click(object sender, EventArgs e) { if (Cbox.Checked) { Alumnus alumnus = new Alumnus( TxtBox_username.Text, TxtBoxFirstName.Text, TxtBoxLname.Text, TxtBoxEmail.Text, TxtBoxPassWord.Text); BusinessManager.CreateAlumnus(alumnus); TxtBox_username.Clear(); TxtBoxFirstName.Clear(); TxtBoxLname.Clear(); TxtBoxEmail.Clear(); TxtBoxPassWord.Clear(); ShowAlumni(); } else { MessageBox.Show("You have not confirmed the information to be saved"); } }
public void limparCampos() { TxtBoxData.Clear(); TxtBoxDescricaoNoticia.Clear(); TxtBoxEmail.Clear(); TxtBoxEscreverNoticia.Clear(); TxtBoxNomeUsuario.Clear(); TxtBoxTipoUsuario.Clear(); TxtBoxTitulo.Clear(); }
private void btncadastrarfrm2_Click(object sender, EventArgs e) { try { //string de conexao //String strConexao = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Users\JR TECH\source\repos\CinemaV1\CinemaV1\bdCadastro.mdb"; //string strconexao = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C: \Users\JR TECH\source\repos\CinemaV1\CinemaV1\bdGeral.mdf;Integrated Security=True"; //cria a conexao OleDbConnection conn = new OleDbConnection(CinemaV1.Properties.Settings.Default.strConexao); //SqlConnection conn = new SqlConnection(strConexao); //abrir conexao (conn) conn.Open(); //comando slq String SQL; SQL = "Insert Into Cadastros(Nome,Email,Senha) Values"; SQL += "('" + TxtBoxUser.Text + "','" + TxtBoxEmail.Text + "','" + TxtBoxPass.Text + "')"; //SqlConnection cmd = new sqlcomand(SQL,conn); OleDbCommand cmd = new OleDbCommand(SQL, conn); cmd.ExecuteNonQuery(); MessageBox.Show("Boa! Hoje tem Cineminha? :) "); TxtBoxUser.Clear(); TxtBoxEmail.Clear(); TxtBoxPass.Clear(); conn.Close(); this.Hide(); Login frmain = new Login(); frmain.Show(); } catch (Exception error) { MessageBox.Show(error.Message); } }