📄 deleteuser.java
字号:
package yd.pethospital.usermanager.jdbc;
import java.sql.*;
import yd.pethospital.share.SystemShare;
import yd.pethosptial.usermanager.view.*;
public class DeleteUser {
public DeleteUser(){
try {
SystemShare.getConnection();
SystemShare.pst=SystemShare.con.prepareStatement("select * from UserInfo ",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
SystemShare.rs=SystemShare.pst.executeQuery(); //rs用于返回SQL语句对数据库的查询等操作
SystemShare.rs.absolute(UserManager.BTCK.getSelectedRow()+1); //记录被选择的行
SystemShare.con.prepareStatement("delete UserInfo where usercode="+SystemShare.rs.getString("usercode")).executeUpdate(); //调用preparement方法进行数据库操作
UserManager.frame.dispose();
SystemShare.delsuccess(); //成功
new UserManager();
}catch (SQLException e) {
e.printStackTrace();
SystemShare.delfail();
}
SystemShare.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -