[thelist] Multiple updates - ASP

Chris Blessing webguy at mail.rit.edu
Thu Oct 31 09:44:00 CST 2002


With the table you're generating, you could certainly generate a form which
contains hidden form fields holding the (for example) apple and orange
product codes or something, and then once they hit the submit button you
could loop through those hidden fields (make them an array if you like) and
execute an update query per product.

Your other option would be to use the shopping cart as the "pre-built" array
of information that they're buying, and execute one update statement (this
will only work obviously if they are ordering the same quantity for all of
the products):

update myAppleAndOrangeTable
set availableStockQuantity = availableStockQuantity - purchaseQuantity
where product = 'apples' or product = 'oranges'

Chris Blessing
webguy at mail.rit.edu

> What I really meant was entering different values for specific records.
> For example, if someone has ordered an apple and an orange I need
> to take 1
> from the stock column for apples and oranges.
> The way I have the information displayed on the page is a table
> showing the
> customer's order. In the table, the product name, number ordered, and
> updated stock numbers are displayed. I have looped through the
> recordset so
> that each item within the customer's order has been displayed.
> I want to be able to hit one submit button and have each record updated
> with the new stock level.
> Help...please!
> Matt

More information about the thelist mailing list