示例#1
0
        private void BotonAgregar_Click(object sender, EventArgs e)
        {
            //try
            //{
                //varialbes para iinsertar en la base de datos
                int numero = Convert.ToInt32(ComboNumero1.Text);
                string tipos = ComboTipo1.Text;
                int numerocamas = Convert.ToInt32(ComboNumeroCama.Text);
                string tipocama = ComboTipoCama1.Text;
                int capcadidad = Convert.ToInt32(ComboCapacidad1.Text);
                decimal tarifa = Convert.ToDecimal(TxtTarifa1.Text);
                // conexion con la base de datos
                MySql.Data.MySqlClient.MySqlConnection conexion = new MySqlConnection(); //objeto
                string cadenaConexion = "server=192.168.1.50;  uid=daviduxotto; pwd=daviduxotto; Port=3306; database=BDHotel";
                conexion.ConnectionString = cadenaConexion;
                conexion.Open();     // abrimos conezion
                String consulta = "update Habitacion  set Tipo='" +tipos + "', NumeroCamas=" + numerocamas + ",TipoCama='" + tipocama + "', Capacidad=" + capcadidad + ", Tarifa=" + tarifa + " where Id="+numero;  // realizamos consulta
                MySqlCommand comando = new MySqlCommand(consulta, conexion);
                comando.ExecuteReader();
                conexion.Clone();
                MessageBox.Show("se ha actualizado con exito");
                habitaciones habitacion = new habitaciones();
                habitacion.Show();
                this.Close();

               // }
            //catch (Exception ex)
               // {
             //   MessageBox.Show("se ha producido un error: " + ex);
            //}
        }
示例#2
0
 private void BotonCancelar_Click(object sender, EventArgs e)
 {
     habitaciones habitacion = new habitaciones();
     habitacion.Show();
     this.Close();
 }
示例#3
0
 private void BotonHabitacion_Click(object sender, EventArgs e)
 {
     habitaciones habitacion = new habitaciones();
     habitacion.Show();
    
 }