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 getRowCount. You can find the number of columns in a query by calling getColumns.
Returns the value of the requested data element.
public String getData(intiRow, intiCol)
IndexOutOfBoundsException If an invalid index is passed to the method.
| Parameter | Description |
|---|---|
|
iRow |
Row to retrieve data from (1-based) |
|
iCol |
Column to retrieve data from (1-based) |
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>" ) ;
}