public static void update(){
try{
System.out.println("请输入要修改的学号");
int id=sc.nextInt();
    
pstm=conn.prepareStatement("update students set name=? where id=?");
pstm.setInt(1, id);
System.out.println("请输入新的姓名:");
String name=sc.next();
pstm.setString(2, name);
int count=pstm.executeUpdate();
if(count!=0){
System.out.println("成功修改"+count+"条数据");
}else{
System.out.println("该学号不存在!");
}
}catch(SQLException e){
System.out.println("修改失败"+e.getMessage());

}

}