繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> 评论及其它 >> Handling Data Concurrency Using ADO.NET

Handling Data Concurrency Using ADO.NET

2005-01-09 20:54:22  作者:notus  来源:互联网  浏览次数:1  文字大小:【】【】【
简介:source:http://msdn.microsoft.com/msdnmag/issues/04/09/DataPoints/default.aspxbegin: Download the code for this article: DataPoints0409.exe (148KB)   One of the key features of the ADO...

source:

http://msdn.microsoft.com/msdnmag/issues/04/09/DataPoints/default.aspx

begin:

Download the code for this article: DataPoints0409.exe (148KB)

One of the key features of the ADO.NET DataSet is that it can be a self-contained and disconnected data store. It can contain the schema and data from several rowsets in DataTable objects as well as information about how to relate the DataTable objectsall in memory. The DataSet neither knows nor cares where the data came from, nor does it need a link to an underlying data source. Because it is data source agnostic you can pass the DataSet around networks or even serialize it to XML and pass it across the Internet without losing any of its features. However, in a disconnected model, concurrency obviously becomes a much bigger problem than it is in a connected model.

In this column, I'll explore how ADO.NET is equipped to detect and handle concurrency violations. I'll begin by discussing scenarios in which concurrency violations can occur using the ADO.NET disconnected model. Then I will walk through an ASP.NET application that handles concurrency violations by giving the user the choice to overwrite the changes or to refresh the out-of-sync data and begin editing again. Because part of managing an optimistic concurrency model can involve keeping a timestamp (rowversion) or another type of flag that indicates when a row was last updated, I will show how to implement this type of flag and how to maintain its value after each database update.

Is Your Glass Half Full?

责任编辑:admin
相关文章