Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering JTable containing ResultSet

Status
Not open for further replies.
May 13, 2002
75
GB
Hi,

I have a Swing app that has a JTable. I have a class that implements TableModel that queries a database then gets data by..
Code:
    public Object getValueAt(int row, int column) {
	try {
	    results.absolute(row+1);                // Go to the specified row
	    Object o = results.getObject(column+1); // Get value of the column
	    if (o == null) return null;       
	    else return o.toString();               // Convert it to a string
	} catch (SQLException e) { return e.toString(); }
    }

Now i want to filter my table upon user request but i'd like to do this ideally withou having to requery the database, has anyone any ideas ?

I guess one option would be do create a new recordset from the old one carrying out some kind of manual filter ? Or copying it row by row to an array doing a manual filter ?
[ponder]
Please let me know if you need any more info / code etc

TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top