RecordSet.removeAll( )


RecordSet.removeAll( ) Method Flash 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 , 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( )



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