wood burning stoves 2.0*
The moose likes JDBC and the fly likes sorting a resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sorting a resultset" Watch "sorting a resultset" New topic
Author

sorting a resultset

Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
I finally made a connection through a ms-access database.
In the database I have a key on the field name so it is sorted.
But in my resultset this is ignored !?!
How can i sort this ? I have tried to to use group by in the sql-statement but this is not allowed since I select everything (select * from .....)
Can anybody help me out ?
Thanks
Here is some code :
// create a statement handlez
Statement sqlStatement = databaseConnection.createStatement();

// create a sql-string
String sql = "SELECT * FROM VELD";
ResultSet results = sqlStatement.executeQuery(sql);

while (results.next()){
m.addElement(results.getString(1));
}

// close connection
databaseConnection.close();
System.out.println("the connection is closed !");

} catch (SQLException sqle) {
System.err.println(sqle);
}
}
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
wouldnt this work?
select rollno,fname,lname from veld order by rollno
the columns are taken as assumption.....


regards,<br />Dharmesh Chheda
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sorting a resultset
 
Similar Threads
Problem with DB2
Compiling with packages
Jlist and Jtextfield
How to get a row count
HELP! Connection to MS Access DB Trouble