// Print the list of columns to the user
response.write( "Columns in query: " ) ;
for( int i=0; i<nNumColumns; i++ )
{
response.write( columns[i] + " " ) ;
}
getData
Description
Retrieves a data element from a row and column of a query. Row and column indexes begin
with 1. You can find the number of rows in a query by calling
number of columns in a query by calling
Returns the value of the requested data element.
Category
Query interface
Syntax
public String getData(int iRow, int iCol)
Throws
IndexOutOfBoundsException
See also
,
setData
addRow
Parameters
Parameter
iRow
iCol
Example
The following example iterates over the rows of a 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++ )
{
for ( iCol = 1; iCol <= nNumCols; iCol++ )
{
response.write( query.getData( iRow, iCol ) + " " ) ;
}
response.write( "<BR>" ) ;
}
774
Chapter 5: ColdFusion Java CFX Reference
If an invalid index is passed to the method.
Description
Row to retrieve data from (1-based)
Column to retrieve data from (1-based)
getRowCount
.
getColumns
. You can find the