コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (radioButton3.Checked)
            {
                try
                {
                    da = new MySqlDataAdapter("select * from folio where Id_reservacion like ('" + textBox1.Text + "%') and TipoCliente like ('" + textBox10.Text + "%') and Habitacion like ('" + comboBox1.Text + "%') and Id_reservacion like ('" + textBox1.Text + "%') and Nombre like ('" + textBox2.Text + "%') and Apellido like ('" + textBox3.Text + "%') and Servicio like ('" + textBox4.Text + "%') and Monto like ('" + textBox5.Text + "%') and Descripcion like ('" + textBox6.Text + "%') ", Conexion.conexion());
                    dt = new DataTable();
                    da.Fill(dt);
                    dataGridView1.DataSource          = dt;
                    dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR");
                }
            }



            if (radioButton4.Checked)
            {
                try
                {
                    da = new MySqlDataAdapter("select * from folio where Id_reservacion like ('" + textBox1.Text + "%') and TipoCliente like ('" + textBox9.Text + "%') and Habitacion like ('" + comboBox1.Text + "%') and Id_reservacion like ('" + textBox1.Text + "%') and Nombre like ('" + textBox2.Text + "%') and Apellido like ('" + textBox3.Text + "%') and Servicio like ('" + textBox4.Text + "%') and Monto like ('" + textBox5.Text + "%') and Descripcion like ('" + textBox6.Text + "%') ", Conexion.conexion());
                    dt = new DataTable();
                    da.Fill(dt);
                    dataGridView1.DataSource          = dt;
                    dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR");
                }
            }//fin if

            if (radioButton5.Checked)
            {
                try
                {
                    da = new MySqlDataAdapter("select * from folio where Id_reservacion like ('" + textBox1.Text + "%') and Habitacion like ('" + comboBox1.Text + "%') and Id_reservacion like ('" + textBox1.Text + "%') and Nombre like ('" + textBox2.Text + "%') and Apellido like ('" + textBox3.Text + "%') and Servicio like ('" + textBox4.Text + "%') and Monto like ('" + textBox5.Text + "%') and Descripcion like ('" + textBox6.Text + "%') ", Conexion.conexion());
                    dt = new DataTable();
                    da.Fill(dt);
                    dataGridView1.DataSource          = dt;
                    dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR");
                }
            }//fin if
        }
コード例 #2
0
 public void calculo_folio()
 {
     try
     {
         da = new MySqlDataAdapter("select SUM(Monto) as Total, Id_reservacion from folio group by Id_reservacion  ", Conexion.conexion());
         dt = new DataTable();
         da.Fill(dt);
         dataGridView1.DataSource          = dt;
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERROR");
     }
 }
コード例 #3
0
 private void btn_guardar_Click(object sender, EventArgs e)
 {
     try
     {
         com = new MySqlCommand("insert into folio (Habitacion, Id_reservacion,TipoCliente, Nombre, Apellido, Servicio, Fecha, Monto, Descripcion) values ('" + Convert.ToInt32(comboBox1.Text) + "', '" + Convert.ToInt32(textBox1.Text) + "', '" + tipoc + "' ,'" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', '" + Convert.ToString(maskedTextBox1.Text) + "', '" + Convert.ToInt32(textBox5.Text) + "', '" + textBox6.Text + "' )", Conexion.conexion());
         com.ExecuteNonQuery();
         mostrar_folio();
         comboBox1.Text = ""; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = "";  textBox4.Text = ""; maskedTextBox1.Text = ""; textBox5.Text = ""; textBox6.Text = "";
         MessageBox.Show("Datos Ingresados");
         textBox1.Clear();
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
         textBox5.Clear();
         textBox6.Clear();
         comboBox1.SelectedIndex = -1;
         maskedTextBox1.Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Datos no ingresados");
     }
 }
コード例 #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     Conexion.conexion();
     MessageBox.Show("Conectado");
 }