如何取得结果集合的行数、每一列的列名?

解决方案 »

  1.   

    http://java.sun.com/j2se/1.4.2/docs/api/
      

  2.   

    Method Summary 
     String getSystemId() 
              Get the system identifier that was set with setSystemId. 
     void setSystemId(String systemId) 
              Set the system identifier for this Result. 
      

  3.   

    please remreber this url:
    http://java.sun.com/j2se/1.5.0/docs/index.html
    it's usefull.
      

  4.   

    行数可以通过 select count(*) from tablename; 来获取;每一列的列名可以通过以下方法获得:private void displayCols(Result rs){int i;ResultSetMetaData rsmd = rs.getMetaData();//获取结果集中的列数
    int numCols = rsmd.getColumnCount();for(i=1;i<=numCols;i++){   if(i>1) System.out.print(",");   System.out.(rsmd.getColumnLabel(i)); }}