?? del_user_c.java
字號:
package project;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JOptionPane;
import java.sql.ResultSet;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Del_user_C {
JFrame mainframe = null;
JPanel Del_user_C_panel = null;
public Del_user_C(JFrame mainframe, JPanel Del_user_C_panel) {
this.mainframe = mainframe;
this.Del_user_C_panel = Del_user_C_panel;
}
public int Del_user_C(String name_text){
if(name_text.equals("")){
JOptionPane.showMessageDialog(this.mainframe, "請選擇要刪除的用戶!",
"提示", JOptionPane.INFORMATION_MESSAGE);
return 0;
}
if(name_text.equals("adm")){
JOptionPane.showMessageDialog(this.mainframe, "您不能刪除這個用戶!",
"提示", JOptionPane.INFORMATION_MESSAGE);
return 1;
}
DataBase db = new DataBase();
String sql = "delete from login_table where loginName='"+name_text+"'";
int ans = JOptionPane.showConfirmDialog(this.mainframe,"真的要刪除這個用戶么?","提示",JOptionPane.INFORMATION_MESSAGE);
if(ans == JOptionPane.OK_OPTION){
int res = db.executeUpdate(sql);
db.close();
if(res > 0){
JOptionPane.showMessageDialog(this.mainframe, "刪除用戶成功!",
"提示", JOptionPane.INFORMATION_MESSAGE);
return 2;
}else{
JOptionPane.showMessageDialog(this.mainframe, "刪除用戶失??!",
"提示", JOptionPane.INFORMATION_MESSAGE);
return 3;
}
}else{
return 4;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -