ResultSetMetaData rsmd = rs.getMetaData();//结果集合元数据
String java.sql.ResultSetMetaData.getColumnName(int column) throws SQLException
getColumnName
String getColumnName(int column) throws SQLException
Get the designated column's name.
对于数据库操作,获取标明的字段名称,下标从1开始
Parameters:column - the first column is 1, the second is 2, ...Returns:column nameThrows:SQLException - if a database access error occurs
String java.sql.ResultSetMetaData.getColumnLabel(int column) throws SQLException
getColumnLabel
String getColumnLabel(int column) throws SQLException
Gets the designated column's suggested title,for use in printouts anddisplays.
获取指定列的推荐的列名,以便在打印输出和显示中使用。
The suggested title is usually specified by the SQL ASclause. If a SQL AS is not specified, the value returned from getColumnLabel will be the same as the value returned by the getColumnName method.
建议的标题通常由SQL as子句指定。如果没有指定AS字句,从getColumnLabel返回的值将与getColumnName方法返回的值相同。
Parameters:column - the first column is 1, the second is 2, ...Returns:the suggested column titleThrows:SQLException - if a database access error occurs
建议使用中获取列名通过getColumnLabel方法获取到,这样可以防止使用别名的时候出现问题