Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

put method

Replaces or adds a record object in an object store.

Internet Explorer 10

 

Syntax

var retVal = IDBObjectStore.put(value, key);

Parameters

value [in]

Type: any

An object literal containing the values to be stored in the object store.

key [in, optional]

Type: any

The key value of the new record.

Exceptions

This method can throw the following DOMException exceptions:

Note  As of Internet Explorer 10, the code property is deprecated in favor of the name property, which is preferred for standards compliance and future compatibility.
Exception propertiesCondition
name: DataCloneError
code: DOMException.DATA_CLONE_ERR (25)

The data could not be stored.

name: DataError

The specified key value is invalid or the value specified for an indexed attribute is invalid.

name: InvalidStateError
code: DOMException.INVALID_STATE_ERR (11)

The data source has been deleted or is otherwise not available.

name: ReadOnlyError

The associated transaction is read-only.

name: TransactionInactiveError

The associated transaction is not active.

 

Standards information

Examples

The following example creates an object store and then uses the put method to populate it.


      oStore = dbHandle.createObjectStore( "ImageTags", oOptions );
      var aImageTags = getInitialTags();
      for ( var x = 0; x < aImageTags.length; x++ ) {
         var hRequest = oStore.put( aImageTags[ x ] );
         hRequest.onsuccess = handleRequestEvent;
         hRequest.onerror = handleRequestEvent;
      }

See also

IDBObjectStore

 

 

Show:
© 2015 Microsoft