根据用户的账户删除该用户的信息(管理员)
//删除用户信息记录(管理员注销用户),根据用户的账户名删除用户
public boolean deleteUser(String userAccount){
boolean flag=false;
try {
connection=mysql01.getConnection();
String sql="delete from user where userAccount="+userAccount;
statement=connection.createStatement();
flag = statement.execute(sql);
} catch (Exception e) {
e.printStackTrace();
}finally {
mysql01.close(connection,statement);
}
return flag;
}
返回值也可以定义为空,但定义为boolean类型是一种比较好的方法,可以得到反馈
当然,该方法只针对管理员!