rs.getString(..)内的参数应该是字段名,你的数据表中有名称为1的字段吗?

解决方案 »

  1.   

    String getString(String columnName)           Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language
      

  2.   

    resultSet取数据之前调用rs.next();方法
      

  3.   

    It doesn't matter,I think, if I use rs.getString(int columnIndex) or 
    rs.getString(Object columnName). These two methods are both offered in 
    the class java.sql.ResultSet.I got an example java program from the java1.4.2sdk documentation whitch also uses "rs.getString(int columnIndex)",and it works well.
      

  4.   

    Oh,I got it!
        I have to use the while(rs.next()){} statement even there was obviously just one record!
    something like this:
    while(rs.next()){
        textName.setText(rs.getString(1));
             .
             .
    }lots of thanks for you all!