my dog learned polymorphism
The moose likes JDBC and the fly likes retrieving column caption in access Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "retrieving column caption in access" Watch "retrieving column caption in access" New topic
Author

retrieving column caption in access

mike sutton
Greenhorn

Joined: Dec 07, 2000
Posts: 14
I am using getMetaData to retrieve column names from a database to build a form in one of my servlets.
I thought that

would return the caption instead of the name, but it is not, or I am doing something wrong.
How can I get the column caption in an access database instead of the column name?
Here is the code from the servlet:
mike sutton
Greenhorn

Joined: Dec 07, 2000
Posts: 14
I am not sure what happened when I tried to post my code, but here it is again
mike sutton
Greenhorn

Joined: Dec 07, 2000
Posts: 14
o.k. third try, this time without the code tag:
try {
stmt = l.dbCon.createStatement();
rs = stmt.executeQuery(qry.toString());
ResultSetMetaData rsmd= rs.getMetaData();
int numberofcolumns = rsmd.getColumnCount();
while(rs.next()){
for (int i =1; i<= numberofcolumns; i++ ){

String columnlabel = rsmd.getColumnLabel(i);
String columnname = rsmd.getColumnName(i);

out.println("<tr>");
out.println("<td >" + columnlabel + "");
out.println("</td>");
out.println("<td >");
out.println("<input type='text' name='"+ columnname +"' size='25'>");
out.println("</td>");
out.println("</tr>");
}
}
}
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: retrieving column caption in access
 
Similar Threads
Getting error
Connection Pooling
To call and load javascript in struts jsp.
How to getParameter value
how to preserve the lastly added contents in table in JSP page?