首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

创造触发器,报索引中丢失IN或OUT参数:1

2013-07-16 
创设触发器,报索引中丢失IN或OUT参数:1创设触发器,报索引中丢失IN或OUT参数:1调用代码如下:boolean execut

创设触发器,报索引中丢失IN或OUT参数:1

创设触发器,报索引中丢失IN或OUT参数:1调用代码如下:boolean executestate = false;Connection conn = getConnection();PreparedStatement pstmt = getPrepareStatement(conn, sql);try {int result = pstmt.executeUpdate();closeConnection(null, pstmt, conn);if (result >= 0) {executestate = true;}} catch (SQLException e) {e.printStackTrace();}return executestate;//----------------------------------------public static PreparedStatement getPrepareStatement(Connection conn,String sql) {PreparedStatement stmt = null;try {if (conn != null) {stmt = conn.prepareStatement(sql);}} catch (SQLException e) {e.printStackTrace();}return stmt;}一直找不到原因,后来将代码调整如下就可以了:boolean executestate = false;Connection conn = getConnection();Statement stmt = getStatement(conn);try {int result = stmt.executeUpdate(sql);closeConnection(null, pstmt, conn);if (result >= 0) {executestate = true;}} catch (SQLException e) {e.printStackTrace();}return executestate;//-------------------------public static PreparedStatement getStatement(Connection conn) {PreparedStatement stmt = null;try {if (conn != null) {stmt = conn.createStatement();}} catch (SQLException e) {e.printStackTrace();}return stmt;}不知道是不是在对触发器进行预编译的时候有什么机制需要验证不,最后我也只能这样处理这个问题了

?

热点排行