MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual page 340

Developing web applications with coldfusion
Table of Contents

Advertisement

314
Retrieves a list of the column names contained in the query.
The following example retrieves the array of columns and 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 ;
// Print the list of columns to the user
response.write( "Columns in query: " ) ;
for( int i=0; i<nNumColumns; i++ )
{
}
Returns:
An array of strings containing the names of the columns in the query.
getData
public String getData(int iRow,
Retrieves a data element from a row and column of the query. Row and column
indexes begin with 1. You can determine the number of rows in the query by
calling getRowCount. You can determine the columns in the query by calling
getColumns.
The following example iterates over the rows of the query and writes the data back
to the user in a simple, space-delimited format:
int iRow, iCol ;
int nNumCols = query.getColumns().length ;
int nNumRows = query.getRowCount() ;
for ( iRow=1; iRow<=nNumRows; iRow++ )
{
}
Parameters:
iRow
iCol
Returns:
The value of the requested data element.
response.write( columns[i] + " " ) ;
int iCol)
throws IndexOutOfBoundsException
for ( iCol=1; iCol<=nNumCols; iCol++ )
{
response.write( query.getData( iRow, iCol ) + " " ) ;
}
response.write( "<BR>" ) ;
— Row to retrieve data from (1-based)
— Column to retrieve data from (1-based)
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents