Name
RecordSet.addItem( ) Method
Synopsis
myRecordSet
.addItem(record
)
Arguments
-
record
An object with properties that match the fields of the existing RecordSet object.
Description
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.
Example
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 "RecordSet.as" var myRecordset_rs = new RecordSet(["First", "Last", "Email"]); myRecordset_rs.addItem({First:"Tom", Last:"Muck", Email:"tom@tom-muck.com"});
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
Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.