Sql – Shopping cart with asp.net and SQL Server reserve items

asp.net, cart, shopping, sql-server

Question has been asked with no answers over a month ago:
Shopping Cart reserve product

Anyway, basically I have a shopping cart for my site in ASP.NET using SQL Server. When a user adds an item to the shopping cart I need to set a value in the product table to reserve the item (in order to avoid more people reserving the item, or buying it). Now, if the current user decides to abondon their cart by closing the browser then how am I to restore the product record to being 'unreserved'? Is there another way of reserving the item globally?

Many thanks

Best Solution

When a user "reserves" an item give the reservation an end date/time (e.g. DateTime.Now + 6 hrs, or whatever), by which they must have purchased the reserved item, otherwise after that date/time the reservation becomes void - I believe this is how the vast majority of bricks-and-mortar shops would work as well.

If you're worried about having a tbReservations table with loads of deprecated rows you can setup a SQL job to clear the table of old/invalid reservations each night or whenever is suitable for the business case.