A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 王海飞 黑马帝   /  2011-7-17 21:38  /  1940 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

运行错误:com.mysql.jdbc.NotUpdatable:  Result  Set  not  updatable.This  result  set  must  come  
from  a  statement  that  was  created  with  a  result  set  type  of  ResultSet.CONCUR_UPD  
ATABLE,  the  query  must  select  only  one  table,  and  must  select  all  primary  keys  f  
rom  that  table.  See  the  JDBC  2.1  API  Specification,  section  5.6  for  more  details  
.  
               at  com.mysql.jdbc.ResultSet.updateDouble(ResultSet.java:3100)  




我的代码段:                        

        String  searchNow_Surplus  =  "select  *  from  USER   where  ID=1";  
                       try{  
                                   Statement  stmt  =  conn.createStatement();  
                                   ResultSet  rst  =  stmt.executeQuery(searchNow_Surplus);  
                                   while(rst.next())  
                                   {  
                                               test  =  test  -  Cost_Rate;  
                                               rst.updateDouble("NOW_SURPLUS",test);  
                                               rst.updateRow();  
                                               i++;  
                                     }  

请问这是为什么呢?

评分

参与人数 1技术分 +1 收起 理由
老罗 + 1 项目经历分享不错,加分。

查看全部评分

1 个回复

倒序浏览
黑马网友  发表于 2011-7-17 21:46:35
沙发
代码给的太不完整了。。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马