• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sorting a resultset

 
Kristof Camelbeke
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wouldnt this work?
select rollno,fname,lname from veld order by rollno
the columns are taken as assumption.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic