public void seleccionarPorId(EstanteEntidad estanteEntidad) { string sql = @"Select IdEstante,NombreEstante,IdProducto,Estado from Estante Where (IdEstante = @IdEstante) "; SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@IdEstante", estanteEntidad.IdEstante); cmd.CommandText = sql; }
public void eliminar(EstanteEntidad estanteEntidad) { string sql = @"Delete from Estante Where (@IdEstante = IdEstante) "; SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@IdEstante", estanteEntidad.IdEstante); cmd.CommandText = sql; }
public void insertar(EstanteEntidad estanteEntidad) { string sql = @"Insert into Estante(NombreEstante,IdProducto,Estado) values (@NombreEstante,@IdProducto,@Estado)"; SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@NombreEstante", estanteEntidad.NombreEstante); cmd.Parameters.AddWithValue("@IdProducto", estanteEntidad.productoEntidad.IdProducto); cmd.Parameters.AddWithValue("@Estado", estanteEntidad.Estado); cmd.CommandText = sql; }
public void actualizar(EstanteEntidad estanteEntidad) { string sql = @"Update Estante SET NombreEstante = @NombreEstante ,IdProducto = @IdProducto ,Estado = @Estado Where (@IdEstante =" + estanteEntidad.IdEstante + ")"; SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@IdEstante", estanteEntidad.IdEstante); cmd.Parameters.AddWithValue("@NombreEstante", estanteEntidad.NombreEstante); cmd.Parameters.AddWithValue("@IdProducto", estanteEntidad.productoEntidad.IdProducto); cmd.Parameters.AddWithValue("@Estado", estanteEntidad.Estado); cmd.CommandText = sql; }