Name

RecordSet.getColumnNames( ) Method

Synopsis

                     myRecordSet.getColumnNames( )

Returns

A comma-separated list of column names in the RecordSet.

Description

The getColumnNames( ) function provides an easy way to retrieve the column names in the recordset. If you think of the recordset as a two-dimensional array of rows and columns. The rows are records referenced by an index number. The columns are the recordset fields referenced by the column names that are contained in each record. The names returned in the getColumnNames( ) method are listed in the order that they appear in the recordset.

Example

The following code gets the list of columns and converts it into an array before tracing each name in the Output window:

var myColumns = myRecordset.getColumnNames( );
var myColumnArray = myColumns.split(",");
for (var i=0; i < myColumnArray.length; i++) {
  trace(myColumnArray[i]);
}

See Also

RecordSet.getLength( ); 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.