import java.awt.BorderLayout;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.awt.event.ActionListener;
public class xiugai extends JFrame {
private JPanel contentPane;
String number1[]=new String[100];
int i;
JList list;
private JTextField no;
String no1;
String empName;
String empsex;
Date empbirthday;
String empphone;
String schoolNo;
String emptype;
String emptitle;
Date da;
private JTextField empname;
private JTextField birth;
private JTextField phone;
private JTextField schoolno;
private JTextField type;
private JTextField title;
String url = "jdbc:sqlserver://127.0.0.1:1433;databaseName=驾校;"
+ "user=dkk;password=dingkangkang";
Connection con = null;
Statement stmt = null;
public xiugai() {
super("修改员工信息");
getContentPane().setLayout(null);
setBounds(100, 100, 475, 457);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("\u5728\u5DE6\u9762\u5217\u8868\u53CC\u51FB\u8981\u4FEE\u6539\u7684\u5458\u5DE5\u5DE5\u53F7");
lblNewLabel.setBackground(Color.BLUE);
lblNewLabel.setBounds(23, 7, 414, 34);
contentPane.add(lblNewLabel);
JLabel label = new JLabel("\u5DE5\u53F7:");
label.setBounds(186, 60, 36, 15);
contentPane.add(label);
no = new JTextField();
no.setEditable(false);
no.setBounds(242, 51, 148, 34);
contentPane.add(no);
no.setColumns(10);
JRadioButton male = new JRadioButton("\u7537");
male.setBounds(252, 130, 54, 23);
contentPane.add(male);
JRadioButton fmale = new JRadioButton("\u5973");
fmale.setBounds(323, 130, 54, 23);
contentPane.add(fmale);
ButtonGroup sexGroup=new ButtonGroup();
sexGroup.add(male);
sexGroup.add(fmale);
JLabel label_2 = new JLabel("\u59D3\u540D\uFF1A");
label_2.setBounds(186, 97, 36, 15);
contentPane.add(label_2);
empname = new JTextField();
empname.setBounds(242, 95, 148, 34);
contentPane.add(empname);
empname.setColumns(10);
birth = new JTextField();
birth.setColumns(10);
birth.setBounds(242, 159, 148, 34);
contentPane.add(birth);
JLabel label_3 = new JLabel("\u51FA\u751F\u65E5\u671F\uFF1A");
label_3.setBounds(180, 168, 71, 15);
contentPane.add(label_3);
JLabel label_4 = new JLabel("\u624B\u673A\u53F7\uFF1A");
label_4.setBounds(180, 203, 71, 15);
contentPane.add(label_4);
phone = new JTextField();
phone.setColumns(10);
phone.setBounds(242, 194, 148, 34);
contentPane.add(phone);
schoolno = new JTextField();
schoolno.setColumns(10);
schoolno.setBounds(242, 238, 148, 34);
contentPane.add(schoolno);
JLabel label_5 = new JLabel("\u5206\u6821\u7F16\u53F7\uFF1A");
label_5.setBounds(180, 246, 71, 15);
contentPane.add(label_5);
JLabel label_6 = new JLabel("\u5458\u5DE5\u7C7B\u522B\uFF1A");
label_6.setBounds(180, 290, 71, 15);
contentPane.add(label_6);
type = new JTextField();
type.setColumns(10);
type.setBounds(242, 281, 148, 34);
contentPane.add(type);
JLabel label_7 = new JLabel("\u5458\u5DE5\u804C\u79F0\uFF1A");
label_7.setBounds(180, 331, 71, 15);
contentPane.add(label_7);
title = new JTextField();
title.setColumns(10);
title.setBounds(242, 328, 148, 34);
contentPane.add(title);
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException e){
e.printStackTrace();
}
try{
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
String sql="SELECT * FROM Employees";
ResultSet rs=stmt.executeQuery(sql);
number1[0]="......员工工号......";
i=1;
while(rs.next()){
number1[i]=rs.getString("empno");
i++;
}
list=new JList(number1);
list.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if(e.getClickCount()==2)
{
String s1=(String)list.getSelectedValue();
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException e1){
e1.printStackTrace();
}
try{
Connection conn=DriverManager.getConnection(url);
PreparedStatement pstmt = conn.prepareStatement("{call dbo.select1(?)}");
pstmt.setString(1,s1);
ResultSet rs=pstmt.executeQuery();
while(rs.next()){
no1=rs.getString("empno");
no.setText(no1);
empName=rs.getString("empname");
empname.setText(empName);
empsex=rs.getString("empsex");
if(empsex.equals("男 "))
{
male.setSelected(true);
}
else {
fmale.setSelected(true);
}
empbirthday=rs.getDate("empbirthday");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String str=sdf.format(empbirthday);
birth.setText(str);
empphone=rs.getString("empphone");
phone.setText(empphone);
schoolNo=rs.getString("schoolno");
schoolno.setText(schoolNo);
emptype=rs.getString("emptype");
type.setText(emptype);
emptitle=rs.getString("title");
title.setText(emptitle);
}
}catch(SQLException e1){
e1.printStackTrace();
}
}
}
});
rs.close();
stmt.close();
conn.close();
}catch(SQLException e){
e.printStackTrace();
}
list.setBounds(10, 39, 119, 493);
contentPane.add(list);
JLabel label_1 = new JLabel("\u6027\u522B\uFF1A");
label_1.setBounds(186, 132, 65, 19);
contentPane.add(label_1);
JButton xiugai = new JButton("\u4FEE\u6539");
xiugai.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException e1){
e1.printStackTrace();
}
try{
Connection conn=DriverManager.getConnection(url);
PreparedStatement pstmt = conn.prepareStatement("{call dbo.update1(?,?,?,?,?,?,?,?)}");
pstmt.setString(1,no.getText());
pstmt.setString(2,empname.getText());
if(male.isSelected())
{
empsex="男";
}else
empsex="女";
pstmt.setString(3,empsex);
String birthday=birth.getText();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
da= new Date(sdf.parse(birthday).getTime());
} catch (ParseException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
pstmt.setDate(4,da);
pstmt.setString(5,phone.getText());
pstmt.setString(6,schoolno.getText());
pstmt.setString(7,type.getText());
emptitle=title.getText();
if("".equals(emptitle))
emptitle=null;
ps
没有合适的资源?快使用搜索试试~ 我知道了~
数据库驾校
共45个文件
class:32个
java:10个
classpath:1个
4星 · 超过85%的资源 需积分: 39 24 下载量 130 浏览量
2018-01-06
10:19:52
上传
评论 4
收藏 58KB ZIP 举报
温馨提示
课程设计的驾校管理系统,以驾校管理员身份登录该系统界面,实现对驾校的学员信息、教练信息、学员考试信息等进行多条件组合查询,索引查看,自动安排考试日期,自动生成学费以及信息修改、录入、删除等功能
资源推荐
资源详情
资源评论
收起资源包目录
123.zip (45个子文件)
123
bin
chaxun.class 4KB
main.class 3KB
main$2.class 603B
zengjia.class 4KB
xiugai$1.class 3KB
age1.class 2KB
age2.class 3KB
zengjia$2.class 951B
age2$1.class 2KB
shanchu$2.class 729B
chaxun$1.class 4KB
main$8.class 605B
age1$1.class 2KB
chaxunjl$1.class 3KB
shanchu.class 2KB
xiugai.class 6KB
huizong$1.class 2KB
huizong.class 2KB
chaxunxz.class 3KB
main$10.class 603B
main$5.class 604B
main$7.class 605B
main$6.class 545B
main$11.class 603B
main$9.class 604B
zengjia$1.class 3KB
main$1.class 740B
xiugai$2.class 3KB
main$3.class 603B
main$4.class 604B
shanchu$1.class 2KB
chaxunjl.class 3KB
.settings
org.eclipse.jdt.core.prefs 598B
src
shanchu.java 3KB
chaxunjl.java 4KB
main.java 4KB
chaxun.java 6KB
age2.java 3KB
huizong.java 3KB
age1.java 3KB
zengjia.java 6KB
chaxunxz.java 2KB
xiugai.java 8KB
.project 379B
.classpath 355B
共 45 条
- 1
资源评论
- lwhldy2019-01-28下错了,还给好评吧,浪费了我一积分
qq_20406099
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功