<%!
public static void UpOnStop(Connection dbConn,String lotType){//19:50--20:00之间停购
String up_sql="update DG_currqc set status='0' where type='" + lotType + "' and status='1'";
PreparedStatement stmt = dbConn.prepareStatement(up_sql);
stmt.executeUpdate();
stmt.close();
}
%>我在jsp页面里申明的dbconn想传到函数里去执行数据库操作
可是却报Unhandled exception type SQLException异常
而如果我把函数内的内容直接写在申明dbconn的下面则会成功执行为什么放在函数里就不行了呢 ???
public static void UpOnStop(Connection dbConn,String lotType){//19:50--20:00之间停购
String up_sql="update DG_currqc set status='0' where type='" + lotType + "' and status='1'";
PreparedStatement stmt = dbConn.prepareStatement(up_sql);
stmt.executeUpdate();
stmt.close();
}
%>我在jsp页面里申明的dbconn想传到函数里去执行数据库操作
可是却报Unhandled exception type SQLException异常
而如果我把函数内的内容直接写在申明dbconn的下面则会成功执行为什么放在函数里就不行了呢 ???
dbConn的声明如下
Connection dbConn = DBConnectionPool.getInstance().getConnection();
<%!
public static void UpOnStop(Connection dbConn,String lotType){//19:50--20:00之间停购
String up_sql="update DG_currqc set status='0' where type='" + lotType + "' and status='1'";
try{
PreparedStatement stmt = dbConn.prepareStatement(up_sql);
stmt.executeUpdate();
}catch(SQLException ex){ex.printStackTrace();}
finally{
stmt.close();
dbcon.close()
}
}
%>
楼主试了看看!