New answers tagged


Are you sure that you need two queries for this? E.g. you could do something like this: UPDATE Product SET Quantity = Quantity - @usedQuantity WHERE Id = @productId AND Quantity >= @usedQuantity Try to execute that and if it doesn't affect 1 row - you don't have enough quantity for the line item. The drawback for your current logic is that you no ...

Top 50 recent answers are included