1.数据库中是否有名为SORT的字段? 2.从rs中取出字段对应值时,必须按照顺序, 
例如:select id,name from daylight 
name = rs.getString("name"); 
id = rs.getString("id"); 
就有可能会报错,必须按照顺序取 
id = rs.getString("id"); 
name = rs.getString("name"); 3.建议还是按照序号取 
rs.getString(1); 
或者你在查询时调整rs中的字段顺序 
select name,id from daylight

解决方案 »

  1.   

    变成rs.getString(1)时同样会报这样一个错误
      SQL错误:[Microsoft][SQLServer JDBC Driver]Invalid operation for the current cursor position.
      

  2.   

    对了你在从rs中取数据之前必须调用。
    rs.next();将游标移到第一条纪录!
      

  3.   

    以下是next方法文档的原文,说的很清楚:
    nextpublic boolean next()
                 throws SQLExceptionMoves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on. If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.
      

  4.   

    你需要rs.next();,然后再取值。
      

  5.   

    thank you rinehart(rinehart) 小弟不胜感激
    快来领分吧
    送200分给rinehart(rinehart)
      

  6.   

    to delfa(雨天):
    哥们,我到哪里领啊?
    ^^