Пример #1
0
        private void buscarDispo()
        {
            string F_entrada = dateTimePicker1.Value.ToString("dd/MM/yyyy");
            string Nombre    = Cliente_nombre_txt.ToString();

            using (SqlConnection Conn = Conexion.ObtnerCOnexion())
            {
                SqlCommand cmd = Conn.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "SELECT Id_dispo, Id_habitacion, Fecha_entrada, Fecha_salida, Estado FROM Disponibilidad_hab where Fecha_entrada like '" + F_entrada + "%'";
                cmd.ExecuteNonQuery();
                DataTable      dt = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
                dataGridView3.DataSource = dt;
                dataGridView3.Refresh();
                Conn.Close();
            }
        }
Пример #2
0
        private void buscarReserva()
        {
            string F_entrada = dateTimePicker1.Value.ToString("dd/MM/yyyy");
            string Nombre    = Cliente_nombre_txt.ToString();

            using (SqlConnection Conn = Conexion.ObtnerCOnexion())
            {
                SqlCommand cmd = Conn.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "SELECT No_cuarto, Nombre_cliente, Fecha_entrada, Fecha_salida, Id_reservacion FROM Reservaciones, Habitaciones where Nombre_cliente like '" + Cliente_nombre_txt.Text + "%' and Fecha_entrada like '" + F_entrada + "%' and Reservaciones.Id_habitacion = Habitaciones.Id_habitacion";
                cmd.ExecuteNonQuery();
                DataTable      dt = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
                dataGridView1.DataSource = dt;
                dataGridView1.Refresh();
                Conn.Close();
            }
        }