我看到一条语句:str=new String(rs.getBytes(1),"GBK");中的getBytes(1)是什么意思啊,JAVA API中没有说参数值是1啊

解决方案 »

  1.   

    getBytespublic byte[] getBytes(int columnIndex)
                    throws SQLException
    Gets the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language. The bytes represent the raw values returned by the driver.你看过api了吧 我看你的代码感觉rs应该是ResultSet.. 然后它的api参考上面。getBytes(1)将第一列的对象以byte[]的形式返回。
      

  2.   

     看错api  再放个地址给你看 http://download.oracle.com/javase/1.3/docs/api/java/sql/ResultSet.html
      

  3.   

    谢谢楼上的,我在我还以为getBytes()是java.lang.String的方法,所以我找到下面的方法:
     byte[] getBytes(String charsetName) 
         使用指定的字符集将此 String 解码为字节序列,并将结果存储到一个新的字节数组中。 
    可以结贴了