Database Design, "Implement Optimistic Concurrency," by Bob Beauchemin [Visual Studio Magazine, August 2003]

Included in this archive are three projects that illustrate optimistic concurrency.

1. DataSetConcurrency - this is where the Visual Studio solution file is located and contains programs that comprise the listings in the article.

2. ChangingUpdate - this project is an illustration of how you would subscribe to the SqlDataAdapter's RowUpdating command and change the updates. In this case, you change an update so that only columns that have changed in the DataSet are included in the update statement.

This sample works on a per-row basis, and can generate a different update statement for each row, based on changed columns.

3. VSConcurrencyChoices - this is a simple Visual Studio Windows application that contains two SqlDataAdapters. In SqlDataAdapter1, the advanced option "Use Optimistic Concurrency" has been checked. In SqlDataAdapter1, the advanced option "Use Optimistic Concurrency" has been unchecked. Look at the code and see the difference in the generated update statements.