/**
* 取得所有列名(以别名形式取出)
* @param rs
* @return
* @throws SQLException
*/
private static String[] getColNames(ResultSet rs) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
int count = rsmd.getColumnCount();
String[] colNames = new String[count];
for (int i = 1; i <= count; i++) {
colNames[i - 1] = rsmd.getColumnLabel(i);
}
return colNames;
}
String sql="select t.id as Id2,t.username as UserName2,t.password as Password2 from test_user t";
声明一下:本人没有积分了.
有知道解快的请帮忙给个回复,谢谢了。