User Guide
Query interface 773
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>" ) ;
}
getColumns
Description
Returns an array of strings containing the names of the columns in the query.
Category
Query interface
Syntax
public String[] getColumns()
Example
The following example retrieves the array of columns, then iterates over the list, writing each
column name back to the user:
// Get the list of columns from the query
String[] columns = query.getColumns() ;
int nNumColumns = columns.length ;
Parameter Description
name Name of column to get index of (lookup is case-insensitive)