基于java+mysql的swing+mysql人力管理系统(java+gui)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于java+mysql的Swing+MySQL人力管理系统(java+gui)
功能介绍:
角色员工、管理员,员工信息表,查询、更新,修改,移除、添加
}
System.out.println("jCBSelectQueryFieldTransfer(). outputStr = " + outputStr);
return outputStr;
}
}
public class DatabaseCourseDesign extends JFrame implements ActionListener {
// 定义组件
// 此定义方法先记住
JLabel jLStudentInfoTable = null;// 学生信息表
JLabel jLSelectQueryField = null;// 选择查询字段
JLabel jLEqual = null;// =
JLabel jLSNo = null;// 学号
JLabel jLSName = null;// 姓名
JLabel jLSSex = null;// 性别
JLabel jLSAge = null;// 年龄
JLabel jLSSpecialty = null;// 专业
JLabel jLSAddress = null;// 住址
JTextField jTFQueryField = null;// 查询字段
JTextField jTFSNo = null;// 学号
JTextField jTFSName = null;// 姓名
JTextField jTFSSex = null;// 性别
JTextField jTFSAge = null;// 年龄
JTextField jTFSSpecialty = null;// 专业
JTextField jTFSAddress = null;// 住址
JButton jBQuery = null;// 查询
JButton jBQueryAll = null;// 查询所有记录
JButton jBInsert = null;// 插入
String userMySql = "root";
String passwordMySql = "123456";
// 构造函数
public DbProcess() {
try {
// mysql数据库设置驱动程序类型
Class.forName("com.mysql.jdbc.Driver");
System.out.println("mysql数据库驱动加载成功");
// sqlserver数据库设置驱动程序类型
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// System.out.println("sqlserver数据库驱动加载成功");
} catch (java.lang.ClassNotFoundException e) {
e.printStackTrace();
}
}
public void connect() {
try {
// mysql数据库
connection = DriverManager.getConnection(urlMySql, userMySql, passwordMySql);
// sqlserver数据库
// connection = DriverManager.getConnection(urlSqlServer);
if (connection != null) {
System.out.println("数据库连接成功");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void disconnect() {// 断开连接
try {
if (connection != null) {
connection.close();
connection = null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public ResultSet executeQuery(String sql) {/// sql为完整符合mysql语法的数据库查询语句
try {
System.out.println("executeQuery(). sql = " + sql);
PreparedStatement pstm = connection.prepareStatement(sql);
} catch (SQLException sqle) {
System.out.println("sqle = " + sqle);
JOptionPane.showMessageDialog(null, "数据操作错误", "错误", JOptionPane.ERROR_MESSAGE);
}
} // 管理员框被选中
}
}// actionPerformed
}
public class DbProcess {
public static String imageIcon = "C:\\Users\\joey\\Desktop\\441222052008\\project\\src\\timg2.jpg";
Connection connection = null;
ResultSet rs = null;
// mysql数据库url
String urlMySql = "jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull";
String userMySql = "root";
String passwordMySql = "123456";
// 构造函数
public DbProcess() {
try {
// mysql数据库设置驱动程序类型
Class.forName("com.mysql.jdbc.Driver");
System.out.println("mysql数据库驱动加载成功");
// sqlserver数据库设置驱动程序类型
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// System.out.println("sqlserver数据库驱动加载成功");
} catch (java.lang.ClassNotFoundException e) {
e.printStackTrace();
}
}
public void connect() {
// 建立查询条件
String sql = "select * from student;";
System.out.println("queryAllProcess(). sql = " + sql);
dbProcess.connect();
ResultSet rs = dbProcess.executeQuery(sql);
// 将查询获得的记录数据,转换成适合生成JTable的数据形式
studentVector.clear();
while (rs.next()) {
Vector v = new Vector();
v.add(rs.getString("sNo"));
v.add(rs.getString("sName"));
v.add(rs.getString("sSex"));
v.add(Integer.valueOf(rs.getInt("sAge")));
v.add(rs.getString("sSpecialty"));
v.add(rs.getString("sAddress"));
studentVector.add(v);
}
studentJTable.updateUI();
dbProcess.disconnect();
} catch (SQLException sqle) {
System.out.println("sqle = " + sqle);
JOptionPane.showMessageDialog(null, "数据操作错误", "错误", JOptionPane.ERROR_MESSAGE);
}
}
public void insertProcess() {
String sNo = jTFSNo.getText().trim();
String sName = jTFSName.getText().trim();
String sSex = jTFSSex.getText().trim();
String sAge = jTFSAge.getText().trim();
String sSpecialty = jTFSSpecialty.getText().trim();
String sAddress = jTFSAddress.getText().trim();
// 建立插入条件
String sql = "insert into student values('";
sql = sql + sNo + "','";
sql = sql + sName + "','";
sql = sql + sSex + "',";
sql = sql + sAge + ",'";
sql = sql + sSpecialty + "','";
sql = sql + sAddress + "');";
System.out.println("insertProcess(). sql = " + sql);
try {
} catch (SQLException ex) {
System.err.println(ex.getMessage());
}
disconnect();
return count;
}
public static void main(String args[]) {
DbProcess dbprocess = new DbProcess();
dbprocess.connect();
}
}
public class change_password extends JFrame implements ActionListener {
// 定义组件
JLabel jLNewPassword = null; // 新密码
JLabel jLNewPasswordAgain = null; // 再次输入新密码
JTextField jTFNewPassword = null; // 新密码
JTextField jTFNewPasswordAgain = null; // 再次输入新密码
JButton jBEnsure = null;// 确认
JPanel jP1, jP2, jP3 = null;
public static DbProcess dbProcess;
public change_password() {
jLNewPassword = new JLabel(" 新 密 码 ");
jLNewPasswordAgain = new JLabel("再次输入新密码");
jTFNewPassword = new JTextField(10);
jTFNewPasswordAgain = new JTextField(10);
jBEnsure = new JButton("确认");
jBEnsure.addActionListener(this);
jP1 = new JPanel();
jP2 = new JPanel();
jP3 = new JPanel();
jP1.add(jLNewPassword);
jP1.add(jTFNewPassword);
jP2.add(jLNewPasswordAgain);
// mysql数据库
connection = DriverManager.getConnection(urlMySql, userMySql, passwordMySql);
// sqlserver数据库
// connection = DriverManager.getConnection(urlSqlServer);
if (connection != null) {
System.out.println("数据库连接成功");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void disconnect() {// 断开连接
try {
if (connection != null) {
connection.close();
connection = null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public ResultSet executeQuery(String sql) {/// sql为完整符合mysql语法的数据库查询语句
try {
System.out.println("executeQuery(). sql = " + sql);
PreparedStatement pstm = connection.prepareStatement(sql);
// 执行查询
rs = pstm.executeQuery();
// 查询结果
} catch (SQLException ex) {
ex.printStackTrace();
}
return rs;
}
// 插入
// executeUpdate 的返回值是一个整数,指示受影响的行数(即更新计数)。
// executeUpdate用于执行 INSERT、UPDATE 或 DELETE 语句
// 以及 SQL DDL(数据定义语言)语句,例如 CREATE TABLE 和 DROP TABLE。
// 执行增、删、改语句的方法
public int executeUpdate(String sql) {
int count = 0;
connect();
try {
Statement stmt = connection.createStatement();
count = stmt.executeUpdate(sql);
} catch (SQLException ex) {
res = rs.getString("PASSWD");
}
dbProcess.disconnect();
if (jTFPassword.getText().equals(res))// 输入密码正确
{// 保存账号和密码
username = jTFUserName.getText();
passwd = jTFPassword.getText();
System.out.println("actionPerformed(). 用户登录成功");
new main_screen();
} else {// 密码错误登录失败
new login_failure();
}
} catch (SQLException sqle) {
System.out.println("sqle = " + sqle);
JOptionPane.showMessageDialog(null, "数据操作错误", "错误", JOptionPane.ERROR_MESSAGE);
}
} // 管理员框被选中
}
}// actionPerformed
}
public class DbProcess {
public static String imageIcon = "C:\\Users\\joey\\Desktop\\441222052008\\project\\src\\timg2.jpg";
Connection connection = null;
ResultSet rs = null;
// mysql数据库url
String urlMySql = "jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull";
String userMySql = "root";
String passwordMySql = "123456";
// 构造函数
public DbProcess() {
try {
// mysql数据库设置驱动程序类型
Class.forName("com.mysql.jdbc.Driver");
System.out.println("mysql数据库驱动加载成功");
// sqlserver数据库设置驱动程序类型
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// System.out.println("sqlserver数据库驱动加载成功");
} catch (java.lang.ClassNotFoundException e) {
e.printStackTrace();
}
JLabel JTFTips = null;// 提示
JPanel jP1, jP2;
public login_failure() {
// 构造函数
JBGoBack = new JButton("返回");
JTFTips = new JLabel("密码或账号输入有误,请重新输入!");
JBGoBack.addActionListener(this);
this.add(JTFTips);
this.add(JBGoBack);
this.setSize(250, 125);
this.setLocation(700, 200);
this.setLayout(new FlowLayout(FlowLayout.CENTER));
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
}
public void actionPerformed(ActionEvent e) {
this.dispose();// 关闭窗口
}
}
public class login extends JFrame implements ActionListener {// 登录界面加一张图片
static String username = null;// 用户名
static String passwd = null;// 密码
// 定义组件
// 标签
JLabel jLHRManagement = null;// 人事管理系统
JLabel jLUserName = null;// 用户名
JLabel jLPassword = null;// 密码
JLabel jLStatus = null;// 身份
JLabel jLImage = null;// 图片
ImageIcon icon = null;// 插图
// 文本
JTextField jTFUserName = null;// 用户名文本框
JPasswordField jTFPassword = null;// 密码文本框 保密的
// 按钮
JButton jBLogin = null;// 登录
JButton jBQuit = null;// 退出
private static DbProcess dbProcess;
String SelectQueryFieldStr = "学号";
// 构造函数
public DatabaseCourseDesign() {
// 创建组件
jLStudentInfoTable = new JLabel("学生信息表");
jLSelectQueryField = new JLabel("选择查询字段");
jLEqual = new JLabel(" = ");
jLSNo = new JLabel("学号");
jLSName = new JLabel("姓名");
jLSSex = new JLabel("性别");
jLSAge = new JLabel("年龄");
jLSSpecialty = new JLabel("专业");
jLSAddress = new JLabel("住址");
jTFQueryField = new JTextField(10);// 查询字段
jTFSNo = new JTextField(10);// 学号
jTFSName = new JTextField(10);// 姓名
jTFSSex = new JTextField(10);// 性别
jTFSAge = new JTextField(10);// 年龄
jTFSSpecialty = new JTextField(10);// 专业
jTFSAddress = new JTextField(10);// 住址
jBQuery = new JButton("查询");
jBQueryAll = new JButton("查询所有记录");
jBInsert = new JButton("插入");
jBUpdate = new JButton("更新");
jBDeleteCurrentRecord = new JButton("删除当前记录");
jBDeleteAllRecords = new JButton("删除所有记录");
// 设置监听
// this关键字代指类DatabaseCourseDesigned,实现了ActionListener接口
jBQuery.addActionListener(this);
jBQueryAll.addActionListener(this);
jBInsert.addActionListener(this);
jBUpdate.addActionListener(this);
jBDeleteCurrentRecord.addActionListener(this);
jBDeleteAllRecords.addActionListener(this);
jCBSelectQueryField = new JComboBox<String>();// 查询字段
insertProcess();
} else if (e.getActionCommand().equals("更新") && !jTFID.getText().isEmpty() && !jTFAuthority.getText().isEmpty()
&& !jTFName.getText().isEmpty() && !jTFSex.getText().isEmpty() && !jTFBirthday.getText().isEmpty()
&& !jTFDepartment.getText().isEmpty() && !jTFJob.getText().isEmpty()
&& !jTFEdu_Level.getText().isEmpty() && !jTFSpcialty.getText().isEmpty()
&& !jTFAddress.getText().isEmpty() && !jTFTEL.getText().isEmpty() && !jTFEmail.getText().isEmpty()
&& !jTFState.getText().isEmpty() && !jTFRemark.getText().isEmpty()) {
System.out.println("actionPerformed(). 更新");
updateProcess();
} else if (e.getActionCommand().equals("删除当前员工")) {
System.out.println("actionPerformed(). 删除当前员工");
deleteCurrentRecordProcess();
} else if (e.getActionCommand().equals("查看人事变动")) {
new person_change();
} else if (e.getActionCommand().equals("修改密码")) {
new change_password();
}
}
public static void main(String[] args) {
new main_screen();
}
public void queryProcess(String sQueryField)
{
try {
// 建立查询条件
String sql = "select * from person where ";
String queryFieldStr = jCBSelectQueryFieldTransfer(SelectQueryFieldStr);// 翻译查询依据,如"员工号"翻译为"ID"
sql = sql + queryFieldStr;
sql = sql + " = ";
sql = sql + "'" + sQueryField + "';";
System.out.println("queryProcess(). sql = " + sql);
dbProcess.connect();
ResultSet rs = dbProcess.executeQuery(sql);
// 将查询获得的记录数据,转换成适合生成JTable的数据形式
EmployeeVector.clear();// 清空原先数据
while (rs.next()) {
Vector v = new Vector();
v.add(rs.getString("ID"));
v.add(rs.getString("AUTHORITY"));
v.add(rs.getString("NAME"));
v.add(rs.getString("SEX"));
System.out.println("updateProcess(). update database failed.");
}
} catch (Exception e) {
System.out.println("e = " + e);
JOptionPane.showMessageDialog(null, "数据操作错误", "错误", JOptionPane.ERROR_MESSAGE);
}
queryProcess(ID);
}
}
public class person_change extends JFrame implements ActionListener {// 人事变动表
// 添加组件
JLabel jLPersonChange = null;// 人事变动表
JLabel jLPerson = null;// 员工号
JLabel jLEqual = null;// =
JLabel jLImage = null;// 插图
ImageIcon icon = null;// 插图
JTextField jTFQueryField = null;// 查询某人
JTextField jTFID = null;// 记录编号
JTextField jTFPerson = null;// 员工号
JTextField jTFChange = null;// 变更代码
JTextField jTFDiscription = null;// 详细记录
JButton jBQuery = null;// 查询某人
JButton jBQueryAll = null;// 查询所有
JPanel jP1, jP2, jP3 = null;
DefaultTableModel PersonChangeTableModel = null;
JTable PersonChangeJTable = null;
JScrollPane PersonChangeJScrollPane = null;
Vector PersonChangeVector = null;
Vector titleVector = null;
private static DbProcess dbProcess = null;
public person_change() {// 构造函数
jBDeleteCurrentRecord.addActionListener(this);
jBDeleteAllRecords.addActionListener(this);
jCBSelectQueryField = new JComboBox<String>();// 查询字段
jCBSelectQueryField.addItem("学号");
jCBSelectQueryField.addItem("姓名");
jCBSelectQueryField.addItem("性别");
jCBSelectQueryField.addItem("年龄");
jCBSelectQueryField.addItem("专业");
jCBSelectQueryField.addItem("住址");
jCBSelectQueryField.addItemListener(new ItemListener() {// 下拉框事件监听
// 匿名内部类实现接口并作为参数传入
// ItemListener监听器 待会再来理解
public void itemStateChanged(ItemEvent event) {
switch (event.getStateChange()) {
case ItemEvent.SELECTED:
SelectQueryFieldStr = (String) event.getItem();
System.out.println("选中:" + SelectQueryFieldStr);
break;
case ItemEvent.DESELECTED:
System.out.println("取消选中:" + event.getItem());
break;
}
}
});
studentVector = new Vector();
titleVector = new Vector();
// 定义表头
// 单列矩阵
// JTable:表格这一段还不太理解
titleVector.add("学号");
titleVector.add("姓名");
titleVector.add("性别");
titleVector.add("年龄");
titleVector.add("专业");
titleVector.add("住址");
// studentTableModel = new DefaultTableModel(tableTitle, 15);
studentJTable = new JTable(studentVector, titleVector);
studentJTable.setPreferredScrollableViewportSize(new Dimension(450, 160));
studentJScrollPane = new JScrollPane(studentJTable);
// 分别设置水平和垂直滚动条自动出现
studentJScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
studentJScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// 为表格添加监听器
studentJTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); // 获得行位置
// 分别设置水平和垂直滚动条自动出现
PersonChangeJScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
PersonChangeJScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// 为表格添加监听器
PersonChangeJTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); // 获得行位置
System.out.println("mouseClicked(). row = " + row);
Vector v = new Vector();
v = (Vector) PersonChangeVector.get(row);
jTFID.setText((String) v.get(0));// 记录编号
jTFPerson.setText((String) v.get(1));// 员工号
jTFChange.setText((String) v.get(2));// 变更代码
jTFDiscription.setText((String) v.get(3));// 详细记录
}
});
jP1 = new JPanel();
jP2 = new JPanel();
jP3 = new JPanel();
jP1.add(jLPersonChange);
jP2.add(PersonChangeJScrollPane);
jP3.add(jLPerson);
jP3.add(jLEqual);
jP3.add(jTFQueryField);
jP3.add(jBQuery);
jP3.add(jBQueryAll);
this.add(jP1);
this.add(jP2);
this.add(jP3);
this.setLayout(new FlowLayout(FlowLayout.CENTER));
this.setTitle(login.username + "--");
this.setSize(500, 500);
this.setLocation(800, 200);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
dbProcess = new DbProcess();
}
public class employee_view extends JFrame implements ActionListener {// 通过文本框是否可编辑来操控用户更新权限
// 定义组件
JButton jBQuery = null;// 查询个人信息
JButton jBUpdate = null;// 更新
JPanel jP1, jP2, jP3, jP4, jP5, jP6, jP7, jP8, jP9, jP10, jP11, jP12, jP13, jP14, jP15, jP16;
static JTextField jTFID = new JTextField(10); // 员工号
static JTextField jTFPassword = new JTextField(10); // 密码
static JTextField jTFAuthority = new JTextField(10); // 用户权限
static JTextField jTFName = new JTextField(10); // 姓名
static JTextField jTFSex = new JTextField(10); // 性别
static JTextField jTFBirthday = new JTextField(10); // 生日
static JTextField jTFDepartment = new JTextField(10); // 所在部门
static JTextField jTFJob = new JTextField(10); // 职务
static JTextField jTFEdu_Level = new JTextField(10); // 受教育程度
static JTextField jTFSpcialty = new JTextField(10); // 专业技能
static JTextField jTFAddress = new JTextField(10); // 家庭住址
static JTextField jTFTEL = new JTextField(10); // 联系电话
static JTextField jTFEmail = new JTextField(10); // 电子邮箱
static JTextField jTFState = new JTextField(10); // 当前状态(T-员工、F-非员工)
static JTextField jTFRemark = new JTextField(10); // 备注
private static DbProcess dbProcess;
// 构造函数
public employee_view() {
JLabel jLID = new JLabel(" 员 工 号 "); // 员工号
JLabel jLPassword = new JLabel(" 密 码 "); // 密码
JLabel jLAuthority = new JLabel("用 户 权 限"); // 用户权限
JLabel jLName = new JLabel(" 姓 名 "); // 姓名
JLabel jLSex = new JLabel(" 性 别 "); // 性别
JLabel jLBirthday = new JLabel(" 生 日 "); // 生日
JLabel jLDepartment = new JLabel(" 所 在 部 门"); // 所在部门
JLabel jLJob = new JLabel(" 职 务 "); // 职务
this.dispose();
}
}
public class DbProcess {
Connection connection = null;
ResultSet rs = null;
// mysql数据库url
String urlMySql = "jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull";
String userMySql = "root";
String passwordMySql = "123456";
// 构造函数
public DbProcess() {
try {
// mysql数据库设置驱动程序类型
Class.forName("com.mysql.jdbc.Driver");
System.out.println("mysql数据库驱动加载成功");
} catch (java.lang.ClassNotFoundException e) {
e.printStackTrace();
}
}
public void connect() {
try {
// mysql数据库
connection = DriverManager.getConnection(urlMySql, userMySql, passwordMySql);
if (connection != null) {
System.out.println("数据库连接成功");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void disconnect() {// 断开连接
try {
if (connection != null) {
jLImage = new JLabel(icon);
jP1 = new JPanel();
jP2 = new JPanel();
jP3 = new JPanel();
jP4 = new JPanel();
jP5 = new JPanel();
// jP1.add(jLHRManagement);
jP1.add(jLImage);
jP2.add(jLUserName);
jP2.add(jTFUserName);
jP2.add(jLPassword);
jP2.add(jTFPassword);
jP3.add(jRBEmployee);
jP3.add(jRBManager);
jP3.add(jBLogin);
jP3.add(jBQuit);
this.add(jP1);
this.add(jP2);
this.add(jP3);
this.setLayout(new FlowLayout(FlowLayout.CENTER));
this.setTitle("人事管理登录界面");
this.setSize(500, 600);
this.setLocation(700, 200);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
dbProcess = new DbProcess();// 数据库驱动
}
// 主方法
public static void main(String[] args) {
new login();
}
@Override
public void actionPerformed(ActionEvent e) {
// 监听器
// 用户退出
if (e.getActionCommand().equals("退出")) {
System.out.println("actionPerformed(). 用户退出");
this.setVisible(false);
String DEPARTMENT = jTFDepartment.getText().trim();
String JOB = jTFJob.getText().trim();
String EDU_LEVEL = jTFEdu_Level.getText().trim();
String SPCIALTY = jTFSpcialty.getText().trim();
String ADDRESS = jTFAddress.getText().trim();
String TEL = jTFTEL.getText().trim();
String EMAIL = jTFEmail.getText().trim();
String STATE = jTFState.getText().trim();
String REMARK = jTFRemark.getText().trim();
// 建立插入条件
String sql = "insert into person values('";
sql = sql + ID + "','";
sql = sql + ID + "','";// 密码初始化与员工号相同
sql = sql + AUTHORITY + "','";
sql = sql + NAME + "','";
sql = sql + SEX + "','";
sql = sql + BIRTHDAY + "','";
sql = sql + DEPARTMENT + "','";
sql = sql + JOB + "','";
sql = sql + EDU_LEVEL + "','";
sql = sql + SPCIALTY + "','";
sql = sql + ADDRESS + "','";
sql = sql + TEL + "','";
sql = sql + EMAIL + "','";
sql = sql + STATE + "','";
sql = sql + REMARK + "');";
System.out.println("insertProcess(). sql = " + sql);
try {
if (dbProcess.executeUpdate(sql) < 1) {
System.out.println("insertProcess(). insert database failed.");
}
} catch (Exception e) {
System.out.println("e = " + e);
JOptionPane.showMessageDialog(null, "数据操作错误", "错误", JOptionPane.ERROR_MESSAGE);
}
queryAllProcess();
}
public void updateProcess() {
String ID = jTFID.getText().trim();
String AUTHORITY = jTFAuthority.getText().trim();