Exemplo n.º 1
0
 public static boolean update(String c, String bid) {
   Connection conn = DB.getConn();
   String sql = "update mdgrouptype set gname = ? where id = " + bid;
   PreparedStatement pstmt = DB.prepare(conn, sql);
   try {
     pstmt.setString(1, c);
     pstmt.executeUpdate();
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     DB.close(pstmt);
     DB.close(conn);
   }
   return true;
 }
Exemplo n.º 2
0
 public static boolean save(String c) {
   Connection conn = DB.getConn();
   String sql = "insert into mdgrouptype(id,gname,statues) values (null, ?,?)";
   PreparedStatement pstmt = DB.prepare(conn, sql);
   try {
     pstmt.setString(1, c);
     pstmt.setInt(2, 0);
     pstmt.executeUpdate();
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     DB.close(pstmt);
     DB.close(conn);
   }
   return true;
 }