Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1449183
  • 博文数量: 254
  • 博客积分: 8696
  • 博客等级: 中将
  • 技术积分: 2961
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-03 16:46
文章分类

全部博文(254)

文章存档

2015年(4)

2014年(18)

2013年(16)

2012年(8)

2011年(25)

2010年(2)

2009年(74)

2008年(107)

分类: Java

2008-09-03 17:18:20

ResultSetMetaData   metaDate   =   rs.getMetaData();  
int   number   =   metaDate.getColumnCount();  
String[]   column   =   new   String[number];  

for   (int   j   =   0;   j   <   column.length;   j++)  
{   
   column[j]   =   metaDate.getColumnName(j   +   1);   
}   

//将字段名保存到数组column中
 
String   getCatalogName(int   column)    
                      Gets   the   designated   column's   table's   catalog   name.    
    String   getColumnClassName(int   column)    
                      Returns   the   fully-qualified   name   of   the   Java   class   whose   instances   are   manufactured   if   the   method   ResultSet.getObject   is   called   to   retrieve   a   value   from   the   column.    
    int   getColumnCount()    
                      Returns   the   number   of   columns   in   this   ResultSet   object.    
    int   getColumnDisplaySize(int   column)    
                      Indicates   the   designated   column's   normal   maximum   width   in   characters.    
    String   getColumnLabel(int   column)    
                      Gets   the   designated   column's   suggested   title   for   use   in   printouts   and   displays.    
    String   getColumnName(int   column)    
                      Get   the   designated   column's   name.    
    int   getColumnType(int   column)    
                      Retrieves   the   designated   column's   SQL   type.    
    String   getColumnTypeName(int   column)    
                      Retrieves   the   designated   column's   database-specific   type   name.    
    int   getPrecision(int   column)    
                      Get   the   designated   column's   number   of   decimal   digits.    
    int   getScale(int   column)    
                      Gets   the   designated   column's   number   of   digits   to   right   of   the   decimal   point.    
    String   getSchemaName(int   column)    
                      Get   the   designated   column's   table's   schema.    
    String   getTableName(int   column)    
                      Gets   the   designated   column's   table   name.  
(上述出自:)
阅读(2152) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~