Sys.Data.AdoNetServiceProxy.insert Method

Inserts new data through the data service.

insert: function(item, resourceSetUri, succeededCallback, failedCallback, userContext, webRequest)

Usage

exampleDataService.insert(item, resourceSetUri, succeededCallback, failedCallback, userContext, webRequest);

Parameters

Parameter

Definition

item

An object that contains the data to insert.

resourceSetUri

The URI of the resource set into which the new data is inserted.

succeededCallback

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

failedCallback

(Optional) The function to execute when the insert operation fails.

userContext

(Optional) The state object for this operation.

webRequest

(Optional) A 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 insert method to add new data through a data service. The insert method immediately executes a single insert operation. If you must execute more than one operation as a single batch, use the createActionSequence method.

You pass the data to insert as a JavaScript object in the item parameter.

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) returned by the data service. The second parameter contains the state object for the data operation. The third parameter contains a description of the operation that was performed. For insert operations, the third parameter contains "insert".

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