File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes retrieving column caption in access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
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://aspose.com/file-tools
 
subject: retrieving column caption in access
 
Similar Threads
How to getParameter value
Getting error
Connection Pooling
how to preserve the lastly added contents in table in JSP page?
To call and load javascript in struts jsp.