System.out.println(sql);
PreparedStatement ps=DBPS.getPs(sql);
try {
ps.setString(1, c.getCname());
ps.setString(2, c.getSex());
ps.setString(3, c.getEmail());
ps.setString(4, c.getTel());
ps.setString(5, c.getAddress());
ps.setInt(6, c.getGid());
ps.executeUpdate();
return true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
public boolean del(int cid) {
if (cid<0) {
return false;
}
String sql="delete from Contact where cid=?";
System.out.println(sql);
PreparedStatement ps=DBPS.getPs(sql);
try {
ps.setInt(1, cid);
ps.executeUpdate();
return true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
public boolean update(Contact c) {
if (c==null) {
return false;
}
String sql="update Contact set cname=?,sex=?,email=?,tel=?,address=?,gid=? where
cid=?";
System.out.println(sql);
PreparedStatement ps=DBPS.getPs(sql);
try {