GeekArticles
Database
SQL ServerAccessing and Updating Data in ASP.NET 2.0: Using Optimistic Concurrency
Author: aspnet.4guysfromrolla.com |
Published: 21st May 2008 |
Visited: 223 times |
Add CommentFiled in: SQL Server
Because multiple users can visit the same web page concurrently, it is possible for a user visiting a data modification page to inadvertently overwrite
the modifications made by another user. Consider a page with an editable GridView. If two users visit this page simultaneously from different computers
and both edit the same row, whomever saves the first will have her changes overwritten by whomever saves the row last. This type of behavior is known as
"last write wins" and is the default behavior for web applications.
"Last write wins" is sufficient in applications where it is very rare for two users to be simultaneously working on the same data. If it is
commonplace for multiple users to be modifying the same set of data, you should consider implementing some form of concurrency control.
There are two flavors of concurrency control: optimistic and pessimistic. Optimistic assumes that concurrency violations are rare and that if such an error
occurs that it's adequate to ask one of the conflicting parties to re-enter their information. Pessimistic concurrency, on the other hand, implements
policies to ensure that concurrency violations cannot occur. These policies may add friction to the end user's data entry experience.
Microsoft offers a form of optimistic concurrency control from the SqlDataSource control that can be enabled by ticking a checkbox. This article looks
at different types of concurrency control and then shows how to implement the built-in optimistic concurrency control offered by the SqlDataSource control.
Read on to learn more!
Read More >
Read Article Sponsored Links
Related Articles
• Speeding Up Data Submission The goal of building an Ajax based application is to ensure that interactivity of the site to the user is highly optimized. One of the main features of Ajax is to create an application that should predict what the user actually needs. As the user key in a letter the application will communicate to t ...
• Swing Extreme Testing - The Data Validation Test The Data Validation Test
The Ok button of the SaveAsDialog should only be enabled if the name that has been entered is valid. A name can be invalid if it contains an illegal character, or if it has already been use ...
• Retrieving XML Data Retrieving XML DataTo retrieve XML data from an XMLType table, you can use a SELECT SQL statement, just as you would if you had to query a relational table. For example, to select the employee with the id set to 100 from the employees XMLType table discussed in the preceding section, you might issue ...
• Accessing Repository Resources with SQL Accessing Repository Resources with SQL
In fact, Oracle XML DB repository resources are stored in a set of database tables and indexes, which can be accessed via SQL. You are not supposed to access those tables directly. Instead, Oracle XML DB provides two public views RESOURCE_VIEW and PATH_VIEW th ...
• Querying Data with Oracle XQuery Querying Data with Oracle XQuery
Starting with Oracle Database 10g Release 2, you can take advantage of a full-featured native XQuery engine integrated with the database. With Oracle XQuery, you can accomplish various tasks involved in developing PHP/Oracle XML applications, operating on any kind of ...
• Breaking up XML into Relational Data Breaking up XML into Relational Data
While the preceding example shows how to construct an XML representation over relational data, the example in this section illustrates how you can shred XML data back into relational data. This reverse operation can be useful if your application works with relati ...
• Read committed--Why transaction can read uncommitted data Hello Tom
Thanks for your time.. I have a question: I understand that by default Oracle uses read committed by statement level, normally other session can't see the modification execept the session that makes the modification itself. Read c ...
• RESTRICT USERS TO INSERT/UPDATE DATA EXCEPT THEIR PRIVILIEGES DEAR TOM
i learn a lot from this platform as a new dba
i have a situation here. i did't write code/script here because i havn't any idea that how i ask from you? i have tried to convey my..
i have a database of almost 60 tables. application d ...