| bsp; { System.err.println("dbclass():"+ex.getMessage());} } //---------------------取得数据库连接------------- public Connection getConn() { return conn; } //---------------------数据库查询----------------- public ResultSet query(String sql) { try { stmt=conn.createStatement(); rs=stmt.executeQuery(sql);} catch(SQLException ex) {System.err.println("query():"+ex.getMessage());} return rs; } //-----------数据库修改--------- public void update(String sql) { try { stmt=conn.createStatement(); stmt.executeUpdate(sql);} catch(SQLException ex) {System.err.println("update():"+ex.getMessage());} } //----------关闭数据源------- public void closestmt() { try{stmt.close();} catch(SQLException ex) {System.err.println("closestmt():"+ex.getMessage());} } //----------关闭链接--------- public void closeconn() { try{conn.close();} catch(SQLException ex) {System.err.println("closeconn()"+ex.getMessage());} } //---------------------转换中文 public String toChinese(String s) { if(s==null) return null; try { String convert=new String(s.getBytes("ISO8859-1"),"gb2312"); return convert; } catch(Exception e){} 上一页 [1] [2] [3] [4] [5] 下一页 |