数据库课程设计—企业工资管理系统(java版+完整代码)(3)

2019-06-17 19:51

t2 = new String(password.getPassword()); if(e.getSource()==logonButton1){ try {

Connection con; Statement sql; ResultSet rs;

Class.forName(\

//Class.forName(\//驱动

con = DriverManager.getConnection(

\ sql=con.createStatement();

rs=sql.executeQuery(\ glname,power,glmm from gly where glname='\查询

//power=rs.getString(\ if(rs.next()) {

if(rs.getString(\&& rs.getString(\ {

name=t1;

GZGLZJM yg = new GZGLZJM(name); frame.dispose();

yg.create();

//JOptionPane.showMessageDialog(new DL(), \登录成功!\

if(JOptionPane.YES_OPTION==0){frame.dispose(); // // } } }

else {

JOptionPane.showMessageDialog(this, \输入用户名或密码错误!\ }

con.close(); sql.close();

}catch (Exception e1) {

// TODO Auto-generated catch block e1.printStackTrace(); } }

if (e.getSource()==logonButton2)

9

{

try {

Connection con; Statement sql; ResultSet rs;

Class.forName(\;

//Class.forName(\//驱动

con = DriverManager.getConnection(

\ sql=con.createStatement();

rs=sql.executeQuery(\ * from yg where name='\查询

if(rs.next()) {

if(rs.getString(\&& rs.getString(\ {

name=t1;

YGDLJM yg = new YGDLJM(name); frame.dispose(); yg.create();

JOptionPane.showMessageDialog(new DL(), \登录成功!\

if(JOptionPane.YES_OPTION==0){frame.dispose(); }

else {

JOptionPane.showMessageDialog(this, \输入用户名或密码错误!\ }

con.close(); sql.close();

}catch (Exception e1) {

// TODO Auto-generated catch block e1.printStackTrace(); } }

if (cancelButton.equals(e.getSource())) // 退出

{

10

System.exit(0); } } }

public void chaxun(){ Connection con; Statement sql; ResultSet rs;

//Vector vector = new Vector(); try {

Class.forName(\ } catch (ClassNotFoundException e1) {

JOptionPane.showMessageDialog(this, \连接数据库失败!\ }

try { con = DriverManager.getConnection(\ba\ sql = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE); //if (b4.equals(\查询所有\

for (int i = 0; i < 50; i++) for (int j = 0; j < 4; j++) table.setValueAt(\ rs = sql.executeQuery(\ no,name,jbgz,jt from yg\ int k = -1;

while (rs.next()) { ++k;

String no = rs.getString(1); String name = rs.getString(2); String jbgz = rs.getString(3); String jt = rs.getString(4);

//int sum= rs.getInt(3)+rs.getInt(4); table.setValueAt(no, k, 0);

11

table.setValueAt(name, k, 1); table.setValueAt(jbgz, k, 2); table.setValueAt(jt, k, 3); //table.setValueAt(sum,k,4);

}

con.close(); sql.close(); }

catch (SQLException e1) {

if(chaxun.equals(\ {

JOptionPane.showMessageDialog(this, \查询失败\

}

else{

JOptionPane.showMessageDialog(this, \刷新失败!\

} } }

public void actionPerformed(ActionEvent e) { if (b1.equals(e.getSource())) { // 录入 Connection con; Statement sql; ResultSet rs; try {

Class.forName(\ } catch (ClassNotFoundException e1) { System.out.println(\ }

try {

con=DriverManager.getConnection(\:3306/dba\

sql = con.createStatement();

rs=sql.executeQuery(\* from gly where glname='\

while(rs.next()){

power=rs.getString(\ }

rs=null;

12

if(power.equals(\ try{ String insertStr = \INTO yg (no,name,jbgz,jt)VALUES('\()+\

sql.executeUpdate(insertStr);

JOptionPane.showMessageDialog(this, \录入成功!\

}

catch(SQLException e2){

JOptionPane.showMessageDialog(this, \输入的数值有误\ }

tf1.setText(\Text(\

chaxun(); }

else{

JOptionPane.showMessageDialog(this, \权限不足,不能操作!\

tf1.setText(\Text(\ }

con.close(); sql.close(); }

catch (SQLException e1) {

JOptionPane.showMessageDialog(this, \录入失败!\ } }

if (b2.equals(e.getSource())) {// 修改 Connection con; Statement sql; ResultSet rs; try {

Class.forName(\ } catch (ClassNotFoundException e1) { System.out.println(\ }

13


数据库课程设计—企业工资管理系统(java版+完整代码)(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:抗肿瘤药物临床应用指导原则

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: