SPDataSourceView.ExecuteUpdate Method
Updates the value of one or more fields in a list item.
Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Protected Overrides Function ExecuteUpdate ( _
keys As IDictionary, _
values As IDictionary, _
oldValues As IDictionary _
) As Integer
'Usage
Dim keys As IDictionary
Dim values As IDictionary
Dim oldValues As IDictionary
Dim returnValue As Integer
returnValue = Me.ExecuteUpdate(keys, _
values, oldValues)
protected override int ExecuteUpdate(
IDictionary keys,
IDictionary values,
IDictionary oldValues
)
Parameters
keys
Type: System.Collections.IDictionaryA dictionary that contains at least one key/value pair. The value of the first pair should be the ID property value of the list item to update.
values
Type: System.Collections.IDictionaryA dictionary that contains at least one key/value pair. Each key is the name of a field in the list item. Each value is a new value for the field.
oldValues
Type: System.Collections.IDictionaryA dictionary that contains at least one key/value pair. Each key is the name of an updated field in the list item. Each value is the old value for the field. The argument passed in this parameter is used to detect update conflicts.
Return Value
Type: System.Int32
A System.Int32 value that is the number of list items updated. In this implementation, the return value is either 0 or 1.
Exceptions
Exception | Condition |
---|---|
NotSupportedException | The current view does not support update operations. |
InvalidOperationException | An update conflict exists. A value passed in the oldValues parameter does not match the current value of the field. |
Remarks
The ExecuteUpdate method updates fields in a single list item. The method first tries to identify the item from the context by examining the UpdateParametersDictionary property. Then, if no item is identified, the method examines the first key in the IDictionary object passed as an argument to the keys parameter.
Important
You cannot update the values of the ID and ContentType fields.