View Single Post
  #2 (permalink)  
Old 04-26-04, 12:13 PM
stdunbar stdunbar is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Superior, CO, USA
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
If I understand your question correctly I think you want to use the getColumnName() method on ResultSetMetaData (see http://java.sun.com/j2se/1.4.2/docs/...tMetaData.html for more information)

Your comment line below would be replaced by:

return( resultSetMetaData.getColumnName( columnIndex ) );


Quote:
Originally Posted by Nerddette
I have been given the following snippet of code, which is part of a ResultSetModel.java file which is used by a file which uses JDBC/SQL data.

Code:
public String getColumnName (int columnIndex) {
        ResultSetMetaData  resultSetMetaData = resultSet.getMetaData();
        //Put some program code here. (They put this in, not me :))
    }
It then tells me to "use one of its methods, so that the above function returns an appropriate heading for each column. "

The GUI columns currently show as the defaults (a-e) and instead I want them to show ComNum, FirstName, Surname, Gender, CountryCode.

Any ideas???

Nerddette
Reply With Quote