Retrieve row data from a table by performing the following general tasks:
Construct a SELECT SQL statement in a String variable.
Create a PreparedStatement object by passing the String variable to the Connection.prepareStatement method.
Call the PreparedStatement.executeQuery method to assign the query results to a ResultSet object.
Traverse through the ResultSet object using the navigational methods to retrieve the row data.
The following navigational methods can be used to traverse a result set:
afterLast1 Position immediately after the last row.
beforeFirst1 Position immediately before the first row.
first1 Move to the first row.
last1 Move to the last row.
next Move to the next row.
previous Move to the previous row.
relative(offset)1 Move a specified number of rows relative to the current row, as specified by the signed offset value. Positive offset values move forward in the result set, relative to the current pointer position in the result set. Negative offset values move backward in the result set. An offset value of zero does not move the current location, but allows you to repopulate the row buffer.
1 This method is not supported for UltraLite Java edition databases.
Close the ResultSet and PreparedStatement objects to free resources.
Discuss this page in DocCommentXchange.
|Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0|