An SQLResultSetFormPane presents the results of an SQL (Structured Query Language) query in a form. The form displays one record at a time and provides buttons that allow the user to scroll forward, backward, to the first or last record, or refresh the view of the results.
To use an SQLResultSetFormPane, set the connection and query properties. Set these properties by using the constructor or the setConnection() and setQuery() methods. Use load() to execute the query and present the first record in the result set. When the results are no longer needed, call close() to ensure that the result set is closed.
The following example creates an SQLResultSetFormPane object and adds it to a frame:
// Create an SQLResultSetFormPane // object. Assume that "connection" // is an SQLConnection object that is // created and initialized elsewhere. SQLResultSetFormPane formPane = new SQLResultSetFormPane (connection, " SELECT * FROM QIWS.QCUSTCDT"); // Load the results. formPane.load (); // Add the form pane to a frame. // Assume that "frame" is a JFrame // created elsewhere. frame.getContentPane ().add (formPane);