Sys.Data.AdoNetServiceProxy.update Method

Updates data through a data service.

update: function(item, succeededCallback, failedCallback, userContext, webRequest)

Usage

exampleDataService.update(item, succeededCallback, failedCallback, userContext, webRequest);

Parameters

Parameter

Definition

item

A JavaScript object that contains the modified data.

succeededCallback

(Optional) The function to execute when the update operation succeeds.

failedCallback

(Optional) The function to execute if the update operation fails.

userContext

(Optional) The state object for this operation.

webRequest

(Optional) The Sys.Net.WebRequest object to use for the Web request instead of the default Web request object.

Return Value

The Sys.Net.WebRequest object that performed the operation.

Remarks

Use the update method to modify existing data through a data service. The update method immediately executes a single update operation. If you must execute more than one operation as a single batch, use the createActionSequence method.

You pass the data to update as a JavaScript object in the item parameter. To construct an object for the item parameter that matches the values in the data repository, you can retrieve the original object from a query.

The signatures for the callback functions must match the following examples:

function callbackSucceeded(result, context, operation)

function callbackFailed(error, context, operation)

The functions that you assign to the callback functions must accept three parameters. The first parameter contains the result (or error) that is returned by the data service. For the succeeded callback function, the first parameter always contains null. The second parameter contains the state object for the data operation. The third parameter contains a description of the operation that was performed. For update operations, the third parameter contains "update".

If you do not provide a value for the webRequest parameter, the AdoNetServiceProxy class creates a new instance of the Sys.Net.WebRequest class.

See Also

Other Resources

Sys.Data.AdoNetServiceProxy Class