- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
// 项目目标:建立员工管理系统第一个版本。// 实现图形用户界面的员工信息查询、增、删、改;与数据库建立,并将修改结果时时保存到数据库。// 模块:1.GUI界面 2.数据库连接 3.查询 4.增、5删 6改(操作数据库) import java.sql.*;import java.awt.*;import java.awt.event.*; import javax.swing.*; public class EmpManageSys implements ActionListener {Connection con;Statement stmt;String sql;ResultSet rs;StringBuffer sb = new StringBuffer(); JTextField jtf2 = new JTextField(张飞,10); JTextField jtf3 = new JTextField(10); JTextField jtf4 = new JTextField(10); JTextField jtf7 = new JTextField(10); JTextField jtf5 = new JTextField(10); JTextField jtf6 = new JTextField(10); JTextField jtf8 = new JTextField(10); JTextField jtf9 = new JTextField(10); JTextArea jta10 = new JTextArea(50, 40); public void actionPerformed(ActionEvent e) {String str = e.getActionCommand();if (查询.equals(str)) { //if check the button of 查询,then go to method of searchEmp()searchEmp();} else if (增加.equals(str)) { //if check the button of 增加,then go to method of addEmp()addEmp();} else if (修改.equals(str)) { //if check the button of 修改,then go to method of alterEmp()alterEmp();} else if (撤除.equals(str)) { //if check the button of 撤除,then go to method of deleteEmp()deleteEmp();}} //this is the constructor. EmpManageSys() {createGUI();connectToDataBase();// searchEmp();// addEmp();// deleteEmp();alterEmp();} //connect to the database by using the method getConnection from the class of JdbcUtil. //You can find the class of JdbcUtil at the button of this page. public Connection connectToDataBase() {con = JdbcUtil.getConnection();System.out.println(con);return con; } public void searchEmp() {jta10.setText();try {stmt = con.createStatement();// sql = select * from Mstar where id= + jtf3.getText();// sql1=select * from sd100343 where =+jtf3.getText();sql = select * from Mstar where chineseName=+ jtf2.getText().toLowerCase().trim() + or id=+ jtf3.getText().toLowerCase().trim() + or engName=+ jtf4.getText().toLowerCase().trim() + or UNIT=+ jtf5.getText().toLowerCase().trim(
文档评论(0)