add a column in the cart object called maxQuantity
on the calculations tab, create a calculation as:
abs([Quantity] > [maxQuantity])?[Quantity] = [maxQuantity]:0
in the add to cart button behavior, bind the maxQuantity column to the stock column in your recordset.
This will prevent the user from being able to set the quantity above what is set in the Database. it wont show an error message, so On your product page, you should probably list the stock so they know the maximum that is available.