是否可以在更新查询中插入字段? 我需要它,因为在更新之前,我需要做一些控制。 p.s我知道我必须使用准备好的声明,但我想知道这个错误,我想这是一个缺少的报价,我看不到。 错误:更新语法错误
int rs = st.executeUpdate("UPDATE shop SET quantity='"
+ Quantity
+ "' from warehouse,product where
warehouse.idProduct=shop.idProduct and
warehouse.idProduct=product.id and product.brand='"
+ Brand + "' and product.productType='" + Product
+ "'");
如果你知道你应该使用准备好的声明,为什么你不这样做?在准备好的声明中,您无论如何都不会收到所有这些引用,因此问题可能会消失。请注意,你给我们的代码不是有效的Java ... –
我以为我可以把一个查询更新,我错了,无论如何,我意识到准备好的语句更容易编写和更多的保护 – OiRc