RecordSet.addItem( )


RecordSet.addItem( ) Method Flash 6

appends a record to a recordset
   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



Flash Remoting
Flash Remoting: The Definitive Guide
ISBN: 059600401X
EAN: 2147483647
Year: 2003
Pages: 239
Authors: Tom Muck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net