are you adding the add to cart button to a data assist results page? Or to a product Details page?
In the case of a results page, the add to cart button will loop for each record in the results set. the add to cart button creates a hidden form element for the product ID and is set to use the ID column from the recordset, each add to cart button will be set to the ID for the particular product, this will set which product the add to cart button is for.
On a results page, the recordset will be filtered to only show one record based on a querystring variable, this will set the product the add to cart button is for.