RecordSet.removeAll( )

RecordSet.removeAll( ) MethodFlash 6

deletes all records in a recordset
myRecordSet.removeAll( )

Description

The removeAll( ) method removes the entire contents of the RecordSet object. The structure (column names) of the RecordSet object remains intact, however, and the internal identifiers in use before calling the removeAll( ) method are not reused.

Example

The following code removes the contents of the RecordSet object:

#include "RecordSet.as"
var myRecordset_rs = new RecordSet(["First", "Last", "Email"]);
myRecordset_rs.addItem({First:"Tom", Last:"Muck", Email:"tom@tom-muck.com"});
myRecordset_rs.addItem({First:"Jack", Last:"Splat", Email:"jack@tom-muck.com"});
myRecordset_rs.removeAll( );
trace(myRecordset_rs.getLength( ));
trace(myRecordset_rs.getColumnNames( ));

In this case, the Output window shows that the recordset has a length of 0, but it also shows that the field names are still in place. If we add a record to the RecordSet object now, the internal identifier of the row will be incremented from where it left off before; the internal identifier numbers of the two rows that existed previously are not reused:

myRecordset_rs.addItem({First:"Jack", Last:"Splat", Email:"jack@tom-muck.com"});
trace(myRecordset_rs.getItemId(0));

The Output window should show "2".

To completely delete the RecordSet object rather than simply empty the contents, you can set it to null:

myRecordset_rs = null;

See Also

RecordSet.getItemId( ), RecordSet.removeItemAt( )



    Part III: Advanced Flash Remoting