Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    australia
    Posts
    2

    Exclamation Unanswered: JDBC-getColumnName

    Hie! I'm a student and I'm having a very big problem in using the ResultSet function. I can't seem to get the code right. I was supposed to modified a part of the code to have show name in the columns heading. Here a the part of the code.

    public String getColumnName (intcolumnIndex) {
    ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
    // put some codes here.
    }

    Can someone help me.. thanks..

  2. #2
    Join Date
    Apr 2004
    Posts
    1
    ResultSetMetaData m = rs2.getMetaData(); // contains metadata

    //about table
    int columns = m.getColumnCount();
    for (int j=1; j<=columns; j++)
    System.out.print(m.getColumnName(j)+ " ");
    System.out.println();
    while (rs2.next()) {
    for (int j=1; j<=columns; j++)
    System.out.print(rs2.getString(j) + " ");
    System.out.println();

    this is some of it .. i hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •