private void button3_Click(object sender, EventArgs e)
        {
            MySqlConnection conectar = new MySqlConnection("server=127.0.0.1; database=unaulavota2; Uid=root; pwd=");

            conectar.Open();
            MySqlCommand     comando = new MySqlCommand(string.Format("SELECT * FROM tipoconsejo"), conectar);
            MySqlDataAdapter adapt   = new MySqlDataAdapter(comando);
            DataTable        dt      = new DataTable();

            adapt.Fill(dt);
            dataGridView1.DataSource = dt;
            dataGridView1.Visible    = true;

            BDprueba limpiar = new BDprueba();

            limpiar.BorrarCampos(this, groupBox1);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            try {
                MySqlConnection conectar = new MySqlConnection("server=127.0.0.1; database=unaulavota2; Uid=root; pwd=");
                conectar.Open();
                MySqlCommand     comando = new MySqlCommand(string.Format("DELETE FROM tipoconsejo WHERE codConsejo='" + textBox3.Text + "'"), conectar);
                MySqlDataAdapter adapt   = new MySqlDataAdapter(comando);
                DataTable        dt      = new DataTable();
                adapt.Fill(dt);
                dataGridView1.DataSource = dt;
                dataGridView1.Visible    = true;

                BDprueba limpiar = new BDprueba();
                limpiar.BorrarCampos(this, groupBox1);
            }
            catch (Exception)
            {
                MessageBox.Show("Rectifique he intente nuevamente");
            }
        }
Example #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            try {
                MySqlConnection conectado = new MySqlConnection("server=127.0.0.1; database=unaulavota2; Uid=root; pwd=;");
                conectado.Open();

                MySqlCommand comando = new MySqlCommand(string.Format("SELECT * FROM candidato"), conectado);

                MySqlDataAdapter adapt = new MySqlDataAdapter(comando);
                DataTable        dt    = new DataTable();
                adapt.Fill(dt);
                dataGridView1.DataSource = dt;
                dataGridView1.Visible    = true;

                BDprueba limpiar = new BDprueba();
                limpiar.BorrarCampos(this, groupBox1);
            }
            catch (Exception)
            {
                MessageBox.Show("Error en la conexion ");
            }
        }