private void btnVoltar_Click(object sender, EventArgs e)
        {
            this.Close();
            SubCadastro sub = new SubCadastro();

            sub.Show();
        }
示例#2
0
        private void btnCadastro_Click(object sender, EventArgs e)
        {
            this.Close();
            SubCadastro cad = new SubCadastro();

            cad.Show();
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            String nome, numerorua, cpf, rg, dataNascimento, rua, bairro, cidade, cep, uf, complemento, email, telefone, celular;

            nome           = txtNome.Text.Trim();
            numerorua      = txtnumeroRua.Text.Trim();
            cpf            = txtCPF.Text.Trim();
            rg             = txtRG.Text.Trim();
            dataNascimento = txtDataNascimento.Text.Trim();
            rua            = txtRua.Text.Trim();
            bairro         = txtBairro.Text.Trim();
            cidade         = txtCidade.Text.Trim();
            cep            = txtCEP.Text.Trim();
            uf             = txtUF.Text.Trim();
            complemento    = txtComplemento.Text.Trim();
            email          = txtEmail.Text.Trim();
            telefone       = txtTelefone.Text.Trim();
            celular        = txtCelular.Text.Trim();

            string Config = "server=127.0.0.1;userid=root;database=bd_commanager";

            MySqlConnection conex = new MySqlConnection(Config);

            conex.Open();
            MySqlCommand Query = new MySqlCommand("INSERT INTO funcionario (Nome, RG, CPF, DataNascimento, Celular, Telefone, Email, CEP, UF, Cidade, Rua, NumeroRua, Bairro, Complemento)" + "VALUES('" + nome + "', '" + rg + "', '" + cpf + "', '" + dataNascimento + "', '" + celular + "', '" + telefone + "', '" + email + "', '" + cep + "', '" + uf + "', '" + cidade + "', '" + rua + "', '" + numerorua + "', '" + bairro + "', '" + complemento + "');", conex);

            Query.ExecuteNonQuery();
            Query.Connection = conex;
            if (conex.State == ConnectionState.Open)
            {
                MessageBox.Show("Cadastrado com sucesso!");
                txtNome.Clear(); txtCPF.Clear(); txtRG.Clear(); txtDataNascimento.Text = Convert.ToString(DateTime.Now); txtRua.Clear(); txtBairro.Clear(); txtCidade.Clear(); txtCEP.Clear(); txtUF.Clear(); txtComplemento.Clear(); txtEmail.Clear(); txtTelefone.Clear(); txtCelular.Clear();
                this.Close();
                SubCadastro sub = new SubCadastro();
                sub.Show();
            }

            else
            {
                MessageBox.Show("Erro ao cadastrar!");
            }
            conex.Close();
        }