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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Field info

Status
Not open for further replies.

kensington43

Technical User
Nov 29, 2005
50
US


How can I output this method where I use a for loop to show all the fields:


Currently I am doing it this long way to get the Field info:
Code:
while (rs.next())
{
    ResultsetMetaData rsmd = rs.getMetaData();
    String myField1 = rsmd.getColumnName(1);
    String myField2 = rsmd.getColumnName(2);
    String myField3 = rsmd.getColumnName(3);

out.println(myField + "," +  myField2 + "," + myField3);
}

My attempt doesnt seem to work because I think I am not correct with my Types?
Code:
while (rs.next())
{
    ResultsetMetaData rsmd = rs.getMetaData[20];
    for(int i = 0;i < 21;i++)
    {
        String myField[i] = rsmd.getColumnName(1);
    }

out.println(myField1 + "," +  myField2 + "," + myField3);
}


 
Doesn't getColumnName[red]s[/red]() return the fields in an array?

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top