日期:2014-05-18  浏览次数:20820 次

存储过程更新数据不能写到数据库 急
存储过程为:
CREATE   PROCEDURE   updateVote(@vVeryGood   bigint,@vGood   bigint,
@vGenenal   bigint,@vBad   bigint,@vVeryBad   bigint   )  

  AS
begin
update   product   set   V1=@vVeryGood,V2=@vGood,V3=@vGenenal,V4=@vBad,
V5=@vVeryBad
select   *   from   product
end
GO
product是表名,V1--V5是字段名

jsp中的调用方法如下:
CallableStatement   callableStatement   =   conn.prepareCall(
                                                "{call   updateVote(?,?,?,?,?)} ");                        
callableStatement.setInt(1,1);
callableStatement.setInt(2,1);
callableStatement.setInt(3,1);
callableStatement.setInt(4,1);
callableStatement.setInt(5,1);
callableStatement.executeUpdate();
callableStatement.close();

目的是把product表中的V1到V5的值设置为1
执行过程中没有错误报告,但数据没有写到数据库中。
如果在jsp中紧接着查看更新的记录,会有结果,但就是写入不到数据库中。
请各们帮忙,看看哪里出了问题,急需!!!

------解决方案--------------------
在数据库管理器中执行存储过程能写进去吗?
------解决方案--------------------
事务没有提交
------解决方案--------------------
CREATE PROCEDURE updateVote(@vVeryGood bigint,@vGood bigint,
@vGenenal bigint,@vBad bigint,@vVeryBad bigint )

AS
update product set V1=@vVeryGood,V2=@vGood,V3=@vGenenal,V4=@vBad,
V5=@vVeryBad
GO


直接这样就可以更新了吧
------解决方案--------------------
你没有提交哦 commit()
------解决方案--------------------
你没有提交哦 commit()

------解决方案--------------------
commit()
------解决方案--------------------
数据库product表里面有v5=1这条记录吗?