www.pudn.com > jinxiaoxitong.rar > InventoryManager.java~7~
package jxc; /** *Title: jxc demo
*Description:
*Copyright: Copyright (c) 2003
*Company:
* @author cwx * @version 1.0 */ import java.sql.*; public class InventoryManager { public InventoryManager() { } static public int queryQty(String wareID){ Connection conn = null; PreparedStatement stmt = null; try { conn = ConnectionManager.getConnection(); stmt = conn.prepareStatement("update Reserve set resQty=resQty-" + saleQty+" where wareID="+wareID); stmt.executeUpdate(); //通过 return true; } catch (java.sql.SQLException e) { System.err.println(e); } finally { //关闭数据库资源 if (stmt != null) { try { stmt.close(); } catch (Exception exception) {} } if (conn != null) { try { conn.close(); } catch (Exception exception) {} } } //失败 return false; } }