求救JSP中如何调用SQLSERVER存储过程
求救JSP中如何调用SQLSERVER存储过程
------解决方案--------------------帮顶。
------解决方案--------------------上网找找
------解决方案--------------------我一个项目中的源码,可供参考
是调用sqlserver2000的存储过程
con = DriverManager.getConnection(driverUrl, userName, password);
call = con.prepareCall ( "{ CALL SAVE_ANSWER (?,?,?,?,?,?) } ");
call.setString(1, userId);
call.setInt(2, examId);
call.setBytes(3, answers.getBytes());
call.setTimestamp(4, new Timestamp(dt.getTime()));
call.setInt(5, score);
call.registerOutParameter (6, Types.INTEGER);
call.execute();
result = call.getInt(6);
------解决方案--------------------try{
int age = 39;
string poetname = "dylan thomas ";
callablestatement proc = connection.preparecall( "{ call set_death_age(?, ?) } ");
proc.setstring(1, poetname);
proc.setint(2, age);
cs.execute();
}catch (sqlexception