ObjectDataSource.OldValuesParameterFormatString ObjectDataSource.OldValuesParameterFormatString ObjectDataSource.OldValuesParameterFormatString ObjectDataSource.OldValuesParameterFormatString Property

定义

获取或设置一个格式字符串,该字符串应用于传递给 DeleteUpdate 方法的原始值的参数名称。Gets or sets a format string to apply to the names of the parameters for original values that are passed to the Delete or Update methods.

public:
 property System::String ^ OldValuesParameterFormatString { System::String ^ get(); void set(System::String ^ value); };
public string OldValuesParameterFormatString { get; set; }
member this.OldValuesParameterFormatString : string with get, set
Public Property OldValuesParameterFormatString As String

属性值

一个表示格式字符串的字符串,它应用于传递给 Delete()Update() 方法的任何 oldValues 或键参数的名称。A string that represents a format string applied to the names of any oldValues or key parameters passed to the Delete() or Update() methods. 默认值为"{0}", 这意味着参数名称为字段名称。The default is "{0}", which means the parameter name is the field name.

注解

OldValuesParameterFormatString属性的值仅应用于主键, 如DataKeyNames使用数据绑定控件的属性标识的属性, 或ConflictDetection属性设置为的CompareAllValues删除和更新方案中的值, 并将原始值集传递给相应的数据方法。The value of the OldValuesParameterFormatString property is applied to primary keys only, such as those that are identified with the DataKeyNames property of a data-bound control, or in delete and update scenarios where the ConflictDetection property is set to the CompareAllValues value, and the set of original values are passed to the corresponding data method.

下面是两种可能更改OldValuesParameterFormatString属性的常见方案:The following are two common scenarios where you might change the OldValuesParameterFormatString property:

  • 你可能需要更改属性以区分更新中的旧值和新值。You might want to change the property to differentiate between old and new values in updates. 如果将CompareAllValues属性设置为值, 则会将原始UpdateParameters值和新值的参数添加到集合中。 ConflictDetectionWhen the ConflictDetection property is set to the CompareAllValues value, parameters for both the original and new values are added to the UpdateParameters collection. 如果没有格式字符串, 则将为每个数据字段创建两个具有相同名称的参数。Without the formatting string, two parameters with the same name would be created for each data field. 通过更改原始值参数的名称, 可以将数据与原始数据源进行比较, 以检测冲突并比较键值。By changing the name of the original value parameter, you can compare the data to the original data source to detect conflicts and compare key values.

  • 某些可视化设计器为原始值和键实现了特定的命名方案。Some visual designers implement a particular naming scheme for original values and keys.

属性委托ObjectDataSourceView OldValuesParameterFormatString给与ObjectDataSource控件相关联的对象的属性。 OldValuesParameterFormatStringThe OldValuesParameterFormatString property delegates to the OldValuesParameterFormatString property of the ObjectDataSourceView object that is associated with the ObjectDataSource control.

适用于

另请参阅