12.17.6 本部分程序中用到的辅助类方法
程序中应用到了辅助类的方法,为了方便读者查阅,下面将其源代码附上,并作出解释说明。
Notice.modifyByID方法用于修改指定公告在数据库中的内容。
throws Exception { DB db = new DB(DBUtil.connectToDB()); title = new String(title.getBytes("GB2312"), "ISO-8859-1"); content = new String(content.getBytes("GB2312"), "ISO-8859-1"); try { String strSql = "update notice set title='" + title + "',content='" + content + "' where id =" + ID; db.ExecSql(strSql); } catch (Exception ex) { System.err.println(ex.getMessage()); throw ex; } finally { try { db.close(); } catch (Exception e) { e.printStackTrace(); } } } |
【责任编辑:
夏书 TEL:(010)68476606】