Contents > CFML Reference > ColdFusion Java CFX Reference > Query interface > setData PreviousNext

setData

Sets a data element in a row and column of a query. Row and column indexes begin with 1. Before calling setData for a given row, call addRow and use the return value as the row index for your call to setData.

Query interface

public void setData(int iRow, int iCol, String data)

IndexOutOfBoundsException If an invalid index is passed to the method.

getData, addRow

Parameter

Description

iRow

Row of data element to set (1-based)

iCol

Column of data element to set (1-based)

data

New value for data element

The following example demonstrates the addition of two rows to a query that has three columns, City, State, and Zip:

// Define column indexes
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" ) ; 

Contents > CFML Reference > ColdFusion Java CFX Reference > Query interface > setData PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.