1
When I add a category A
, and add a product X
with the category A
(table categories), then edit the category name A
for category B
, the category of product X
(products table) remains with the category A
.
My update query is
UPDATE Categorias set Categoria = @Categoria WHERE IDCatg = @IDCatg
Basically wanted that when the category A
was edited (table categories), check if there is any product with the category A
(products table), and in addition to update to the category A
to the B
, edit the product category X
for B
. If the category is not in any product, edit normally, for this purpose the query described above.
In your products table you keep the text of the Category or Idcatg? The correct would be the ID this way you will automatically have the products always updated.
– Maicon Carraro
Show how your table structure looks
Produtos
– Maicon Carraro
I keep the Category. The structure is: Idproduct, Brand, Name, Category.
– Chirag Geiantilal
Can’t you change the structure to save the ID? This will save you a lot of headaches
– Maicon Carraro
At this stage I have no way. Is there any solution for it edit?
– Chirag Geiantilal