SqlDataSourceView.ConflictDetection 属性

定义

获取或设置值,该值指示操作期间基础数据库中的一行数据更改时,SqlDataSource 控件如何执行更新和删除。

public:
 property System::Web::UI::ConflictOptions ConflictDetection { System::Web::UI::ConflictOptions get(); void set(System::Web::UI::ConflictOptions value); };
public System.Web.UI.ConflictOptions ConflictDetection { get; set; }
member this.ConflictDetection : System.Web.UI.ConflictOptions with get, set
Public Property ConflictDetection As ConflictOptions

属性值

ConflictOptions

ConflictOptions 值之一。 默认为 OverwriteChanges 值。

例外

所选值不是 ConflictOptions 值之一。

注解

ConflictDetection 属性确定是否将旧值和新值的参数应用于 Update 该方法。 例如,如果属性指定的命令返回DataSet包含列Number``Name的对象,并且该ConflictDetection属性设置为OverwriteChanges值,则会为Number``Name更新操作创建参数。SelectCommand If the ConflictDetection property is set to the CompareAllValues value, parameters are created for Name, Number, original_Name, and original_Number. (原始值的参数的确切名称取决于 OldValuesParameterFormatString.) 然后,该 SqlDataSourceView 对象确定属性中指定的 UpdateCommand 方法是否具有匹配的参数。

并发控制是一种技术数据存储,用于控制在多个客户端访问和操作相同数据时在存储中读取和更改数据的方式。 例如,一个客户端读取数据并将其呈现给用户,而另一个客户端读取相同的数据,并将其呈现给其他用户。 如果两个用户都更新数据并将其提交到数据存储,则可能会出现一些意外的结果,因为两个客户端可能会更新相同数据的不同值。 这被视为冲突。 通过将属性设置为ConflictDetectionCompareAllValues值,更新操作随后可以将旧值和新值与原始数据源进行比较,以检测冲突并根据需要进行处理。

属性的值 ConflictDetection 存储在视图状态中。

适用于

另请参阅