当前位置:首页>> >>


职工管理系统.rar

收藏

资源目录
    文档预览:
    编号:20181030003753136    类型:共享资源    大小:1.30MB    格式:RAR    上传时间:2018-10-30
    尺寸:148x200像素    分辨率:72dpi   颜色:RGB    工具:   
    35
    金币
    关 键 词:
    职工 管理 系统
    资源描述:
    JISHOU UNIVERSITY程 序 设 计 基 础课 程 设 计题 目: 职工管理系统作 者: 王苏岳学 号: 20154206239所属学院: 软件学院专业年级: 软件工程 2015 级 4 班指导教师: 宋旭东完成时间: 2016 年 6 月 2 日—2016 年 6 月 12 日软件学院制项目描述目的: 将员工的信息收集起来进行系统化管理意义: 提高工作管理效率项目功能目标实现基本的增删查改,添加一些新功能:系统主要流程登录界面管理员登录 员工登录注册查看信息 修改 / 更新状态修改 删除完成注册代码数据库连接:package connect;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.Statement;public class MyDBConnection {private String DBDriver;private String DBURL;private String DBUser;private String DBPass;private Connection conn = null;private Statement stmt = null;public MyDBConnection(String driver , String dburl,String user,String pass){DBDriver = driver ;DBURL = dburl;DBUser = user ;DBPass = pass ;try{Class.forName(DBDriver);System.out.println(“数据库驱动程序加载成功!“);}catch(Exception e){e.printStackTrace();}try{conn = DriverManager.getConnection(DBURL,DBUser,DBPass);System.out.println(“连接数据库成功!“);stmt = conn.createStatement();}catch(Exception e){e.printStackTrace();}}public Connection getMyConnection() {return conn;}public Statement getMyStatement(){return stmt;}public void closeMyConnection(){try{conn.close();}catch (SQLException e){e.printStackTrace();}}public String toString(){return “数据库驱动程序“+DBDriver+“,连接地址“+DBURL+“,用户名“+DBUser+“,密码“+DBPass;}}数据库登录package connect;import java.sql.Connection;import java.sql.ResultSet;import java.sql.Statement;public class DBOperation {private MyDBConnection myDB= null ;private Connection conn = null ;private Statement stmt = null ;public DBOperation(MyDBConnection myDB ){conn = myDB.getMyConnection();stmt = myDB.getMyStatement();}public void inserData(String account,String password){try{String newaccount = new String(account.getBytes(),“GBK“);String sql =“INSERT INTO creater(account,password) VALUES('“+newaccount+“',“+password+“)“;stmt.executeUpdate(sql);}catch(Exception e1){e1.printStackTrace();}}public void inserData_1(String name, String sex, String age, String num, String department, String task){try{String newname = new String(name.getBytes(),“GBK“);String sql =“INSERT INTO worker(name,sex,age,num,department,task) VALUES('“+newname+“','“+sex+“',“+age+“,'“+num+“','“+department+“','“+task+“')“;stmt.executeUpdate(sql);}catch(Exception e1){e1.printStackTrace();}}public void select_(){try{String sql =“SELECT account,password“;ResultSet rs = stmt.executeQuery(sql);while(rs.next()){}}catch(Exception e){e.printStackTrace();}}}数据库删除package connect;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;public class Delete_1 {private MyDBConnection myDB= null ;private Connection conn = null ;private static Statement stmt = null ;public Delete_1(MyDBConnection myDB ){conn = myDB.getMyConnection();stmt = myDB.getMyStatement();}public static void deleteData(String str){String sql = “DELETE FROM worker WHERE num ='“+str+“'“;System.out.println(sql);try{stmt.execute(sql);}catch (SQLException e){e.printStackTrace();}}}数据库输出package connect;import jiemian.Administrators;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JTable;public class Form {private MyDBConnection myDB= null ;private Connection conn = null ;private static Statement stmt = null ;private static JTable table;public Form (MyDBConnection myDB ){conn = myDB.getMyConnection();stmt = myDB.getMyStatement();}public static String[][] form(){String sql=“SELECT * FROM worker“;String[][] info = new String[count()][6];int i=0;try {ResultSet rs=stmt.executeQuery(sql);while(rs.next()){info[i][0]=rs.getString(“name“);info[i][1]=rs.getString(“sex“);info[i][2]=rs.getString(“age“);info[i][3]=rs.getString(“num“);info[i][4]=rs.getString(“department“);info[i][5]=rs.getString(“task“);i++;}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return info;}public static int count(){int count=0;String sql=“SELECT * FROM worker“;try {ResultSet rs=stmt.executeQuery(sql);while(rs.next()){count++;}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return count;}public static JTable informationOrder(){String DBDriver =“org.gjt.mm.mysql.Driver“;String DBURL = “jdbc:mysql://localhost:3306/test“;String DBUser = “root“;String DBPass = “123456“;MyDBConnection myDB = new MyDBConnection(DBDriver,DBURL,DBUser,DBPass);Connection conn = myDB.getMyConnection();String[] title = {“姓名“,“性别“,“年龄“ ,“工号“,“部门“,“任务“};table=new JTable(form(),title);return table;}}数据库查找package connect;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.util.HashSet;public class Select_1 {HashSet User_1 = new HashSet();private MyDBConnection myDB= null ;
    展开阅读全文
    1
      金牌文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    0条评论

    还可以输入200字符

    暂无评论,赶快抢占沙发吧。

    关于本文
    本文标题:职工管理系统.rar
    链接地址:http://www.gold-doc.com/p-255485.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服客服 - 联系我们
    [email protected] 2014-2018 金牌文库网站版权所有
    经营许可证编号:浙ICP备15046084号-3
    收起
    展开