RecordSet.addItem( )

RecordSet.addItem( ) MethodFlash 6

appends a record to a recordset



An object with properties that match the fields of the existing RecordSet object.


The addItem( ) method is the easiest way to add a new record to a RecordSet object. The record is simply appended to the end of the recordset.


The following code creates a recordset and adds one row to it using the addItem( ) method. The argument for addItem( ) is a generic object with properties that match the fields of the recordset:

#include ""
var myRecordset_rs = new RecordSet(["First", "Last", "Email"]);
myRecordset_rs.addItem({First:"Tom", Last:"Muck", Email:""});

In this case, the record is created on the fly and added to the RecordSet object named myRecordset_rs. The new record is added at the end of the recordset and the length of the recordset is increased by one.

The property names of the new record should match the field names of the existing recordset. Only the properties that have matching field names will be added. If you add this record to the myRecordset_rs object:

myRecordset_rs.addItem({First:"Biff", Last:"Bop", Phone:"555-555-5555"});

only the First and Last fields will be added to the new record in the recordset. The Phone field will be lost.

See Also

RecordSet.addItemAt( ); Chapter 4

    Part III: Advanced Flash Remoting