Jsharp
发贴: 30
积分: 0
|
于 2006-08-03 02:11
数据库sqlserver2000 操作系统 xp2 个人版 IDE jbuilder 2005or2006 存储过程如下 create proc selectcash @uid varchar(50),@cash money out as select @cash=cash from userinfo where uid=@uid 程式代码如下 try { cst = conn.prepareCall("{call selectcash(?,?)}"); cst.setInt(1,id);//cst为定义过的CallableStatement的对象 cst.registerOutParameter(2,java.sql.Types.DECIMAL,3); //cst.registerOutParameter(2,java.sql.Types.DOUBLE); cst.execute(); //这里为什么不能用double? java.math.BigDecimal cash=cst.getBigDecimal(2); //Double cash=cst.getDouble(2); System.out.println(cash); } catch (SQLException ex) { } 为什么不能用double类型接收sql中的money类型?还是java的机制? 谢谢大家
Jsharp edited on 2006-08-03 02:21
|