You could do it that way. One possible problem is that if you have two concurrent users, the session-based datasets will become out of sync and you'll end up with errors in the database. A solution to this is to run some custom ADO.NET code to execute an UPDATE against the database to remove the item from stock before (or as part of the process of) accepting the order. However, if the user abandons a shopping cart, you'll then have to put the item back in stock. So there are issues to consider both ways.
Once you go beyond simple updates to a single table, you probably need to look at using ADO.NET code and a transaction to perform updates to multiple tables in the database rather than depending on the data source controls to do the updates. This is outside the scope of the book, but it a well-documented process. I suggest looking on the Net for tutorials and examples of using ADO.NET 2.0, or pick up a book that focuses on this topic.
|