Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 6th, 2007, 05:11 PM
Authorized User
Join Date: Sep 2006
Location: Mitcham, London, United Kingdom.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating products quantity when order item insert


I am modifying the Webshop and have come to the stage of handling orders and products.I added a quantity column to the product table which stores the quantity for each product and want the value to be updated each time items are inserted into the OrderDetail table.

Can someone advice me on how to come up with the stored procedure to do that and were exacly to call it in code.I am kind of blank on where to start.

Thanks in advance.

  #2 (permalink)  
Old June 7th, 2007, 02:30 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi Tawanda,

I think the first advice is: step back from your computer, take a piece of paper and a pen (or, if you're attached to your computer use something like Visio) and draw the process.

Once you do that, things will clear up. You'll see how and where people put stuff in their cart, when they are about to finalize their order and when they actually do finalize their order.

That's the point where you need to hook into your supply system. Basically, whenever someone confirms the order, that's where you need subtract the ordered quantity from the stock.

So, in the stored procedure that finalizes the order, you can add additional code to decrease the stock. Something like:

UPDATE Product SET Stock = Stock = @quantity WHERE Id = @productId

Just an example, but hopefully you get the idea.



Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Products in the WebShop ASPLee BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 March 10th, 2007 11:24 PM
Insert into & order by... kiwikencox SQL Server 2000 5 October 13th, 2005 05:06 AM
SELECT/ORDER/INSERT Stuart Stalker SQL Server DTS 1 July 24th, 2005 01:00 AM
updating unit_in_stock column after order olambe SQL Server 2000 7 June 7th, 2004 04:33 PM

All times are GMT -4. The time now is 08:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.