User Guide
1078 Chapter 8: ColdFusion Java CFX Reference
int iCity = 1, iState = 2, iZip = 3 ;
// First row
int iRow = query.addRow() ;
query.setData( iRow, iCity, "Minneapolis" ) ;
query.setData( iRow, iState, "MN" ) ;
query.setData( iRow, iZip, "55345" ) ;
// Second row
iRow = query.addRow() ;
query.setData( iRow, iCity, "St. Paul" ) ;
query.setData( iRow, iState, "MN" ) ;
query.setData( iRow, iZip, "55105" ) ;
getColumnIndex
Description
Returns the index of the column, or 0 if no such column exists.
Category
Query interface
Syntax
public int getColumnIndex(String name)
See also
getColumns
, getData
Parameters
Example
The following example retrieves the index of the EMAIL column and uses it to output a list of the
addresses contained in the column:
// Get the index of the EMAIL column
int iEMail = query.getColumnIndex( "EMAIL" ) ;
// Iterate over the query and output list of addresses
int nRows = query.getRowCount() ;
for( int iRow = 1; iRow <= nRows; iRow++ )
{
response.write( query.getData( iRow, iEMail ) + "<BR>" ) ;
}
Parameter Description
name Name of column to get index of (lookup is case-insensitive)