标题: 项目经历:操作数据库时发生的错误 [打印本页] 作者: 王海飞 时间: 2011-7-17 21:38 标题: 项目经历:操作数据库时发生的错误 运行错误: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++;
}